8011044: Remove support for 1.5 and earlier source and target options
Reviewed-by: darcy, jjg
Contributed-by: neil.toda@oracle.com, brian.goetz@oracle.com
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Thu Jul 10 13:57:27 2014 -0700
@@ -105,7 +105,11 @@
this.name = name;
}
- public static final Source DEFAULT = JDK1_9;
+ public static final Source MIN = Source.JDK1_6;
+
+ private static final Source MAX = values()[values().length - 1];
+
+ public static final Source DEFAULT = MAX;
public static Source lookup(String name) {
return tab.get(name);
@@ -121,19 +125,6 @@
return Target.JDK1_1;
}
- /** Allow encoding errors, giving only warnings. */
- public boolean allowEncodingErrors() {
- return compareTo(JDK1_6) < 0;
- }
- public boolean allowAsserts() {
- return compareTo(JDK1_4) >= 0;
- }
- public boolean allowCovariantReturns() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowGenerics() {
- return compareTo(JDK1_5) >= 0;
- }
public boolean allowDiamond() {
return compareTo(JDK1_7) >= 0;
}
@@ -146,37 +137,6 @@
public boolean allowImprovedCatchAnalysis() {
return compareTo(JDK1_7) >= 0;
}
- public boolean allowEnums() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowForeach() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowStaticImport() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowBoxing() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowVarargs() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowAnnotations() {
- return compareTo(JDK1_5) >= 0;
- }
- // hex floating-point literals supported?
- public boolean allowHexFloats() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean allowAnonOuterThis() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean addBridges() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean enforceMandatoryWarnings() {
- return compareTo(JDK1_5) >= 0;
- }
public boolean allowTryWithResources() {
return compareTo(JDK1_7) >= 0;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Thu Jul 10 13:57:27 2014 -0700
@@ -367,11 +367,9 @@
} catch (CompletionFailure e) {
sym.flags_field |= PUBLIC;
((ClassType) sym.type).supertype_field = objectType;
- Name n = target.boxWithConstructors() ? names.init : names.valueOf;
MethodSymbol boxMethod =
- new MethodSymbol(PUBLIC | STATIC,
- n,
- new MethodType(List.of(type), sym.type,
+ new MethodSymbol(PUBLIC | STATIC, names.valueOf,
+ new MethodType(List.of(type), sym.type,
List.<Type>nil(), methodClass),
sym);
sym.members().enter(boxMethod);
@@ -528,9 +526,7 @@
comparableType = enterClass("java.lang.Comparable");
comparatorType = enterClass("java.util.Comparator");
arraysType = enterClass("java.util.Arrays");
- iterableType = target.hasIterable()
- ? enterClass("java.lang.Iterable")
- : enterClass("java.util.Collection");
+ iterableType = enterClass("java.lang.Iterable");
iteratorType = enterClass("java.util.Iterator");
annotationTargetType = enterClass("java.lang.annotation.Target");
overrideType = enterClass("java.lang.Override");
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Thu Jul 10 13:57:27 2014 -0700
@@ -80,8 +80,6 @@
final Symtab syms;
final JavacMessages messages;
final Names names;
- final boolean allowBoxing;
- final boolean allowCovariantReturns;
final boolean allowObjectToPrimitiveCast;
final Check chk;
final Enter enter;
@@ -105,8 +103,6 @@
syms = Symtab.instance(context);
names = Names.instance(context);
Source source = Source.instance(context);
- allowBoxing = source.allowBoxing();
- allowCovariantReturns = source.allowCovariantReturns();
allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
chk = Check.instance(context);
enter = Enter.instance(context);
@@ -292,7 +288,6 @@
if (tPrimitive == sPrimitive) {
return isSubtypeUnchecked(t, s, warn);
}
- if (!allowBoxing) return false;
return tPrimitive
? isSubtype(boxedClass(t).type, s)
: isSubtype(unboxedType(t), s);
@@ -1484,8 +1479,7 @@
return true;
if (t.isPrimitive() != s.isPrimitive())
- return allowBoxing && (
- isConvertible(t, s, warn)
+ return (isConvertible(t, s, warn)
|| (allowObjectToPrimitiveCast &&
s.isPrimitive() &&
isSubtype(boxedClass(s).type, t)));
@@ -3844,8 +3838,6 @@
if (hasSameArgs(r1, r2))
return covariantReturnType(r1.getReturnType(), r2res, warner);
- if (!allowCovariantReturns)
- return false;
if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
return true;
if (!isSubtype(r1.getReturnType(), erasure(r2res)))
@@ -3861,7 +3853,6 @@
public boolean covariantReturnType(Type t, Type s, Warner warner) {
return
isSameType(t, s) ||
- allowCovariantReturns &&
!t.isPrimitive() &&
!s.isPrimitive() &&
isAssignable(t, s, warner);
@@ -3889,13 +3880,11 @@
* Return the primitive type corresponding to a boxed type.
*/
public Type unboxedType(Type t) {
- if (allowBoxing) {
- for (int i=0; i<syms.boxedName.length; i++) {
- Name box = syms.boxedName[i];
- if (box != null &&
- asSuper(t, syms.enterClass(box)) != null)
- return syms.typeOfTag[i];
- }
+ for (int i=0; i<syms.boxedName.length; i++) {
+ Name box = syms.boxedName[i];
+ if (box != null &&
+ asSuper(t, syms.enterClass(box)) != null)
+ return syms.typeOfTag[i];
}
return Type.noType;
}
@@ -4074,10 +4063,6 @@
}
if (giveWarning && !isReifiable(reverse ? from : to))
warn.warn(LintCategory.UNCHECKED);
- if (!allowCovariantReturns)
- // reject if there is a common method signature with
- // incompatible return types.
- chk.checkCompatibleAbstracts(warn.pos(), from, to);
return true;
}
@@ -4101,10 +4086,6 @@
Type t2 = to;
if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
return false;
- if (!allowCovariantReturns)
- // reject if there is a common method signature with
- // incompatible return types.
- chk.checkCompatibleAbstracts(warn.pos(), from, to);
if (!isReifiable(target) &&
(reverse ? giveWarning(t2, t1) : giveWarning(t1, t2)))
warn.warn(LintCategory.UNCHECKED);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jul 10 13:57:27 2014 -0700
@@ -127,12 +127,6 @@
Options options = Options.instance(context);
Source source = Source.instance(context);
- allowGenerics = source.allowGenerics();
- allowVarargs = source.allowVarargs();
- allowEnums = source.allowEnums();
- allowBoxing = source.allowBoxing();
- allowCovariantReturns = source.allowCovariantReturns();
- allowAnonOuterThis = source.allowAnonOuterThis();
allowStringsInSwitch = source.allowStringsInSwitch();
allowPoly = source.allowPoly();
allowTypeAnnos = source.allowTypeAnnotations();
@@ -168,26 +162,6 @@
*/
boolean allowTypeAnnos;
- /** Switch: support generics?
- */
- boolean allowGenerics;
-
- /** Switch: allow variable-arity methods.
- */
- boolean allowVarargs;
-
- /** Switch: support enums?
- */
- boolean allowEnums;
-
- /** Switch: support boxing and unboxing?
- */
- boolean allowBoxing;
-
- /** Switch: support covariant result types?
- */
- boolean allowCovariantReturns;
-
/** Switch: support lambda expressions ?
*/
boolean allowLambda;
@@ -200,11 +174,6 @@
*/
boolean allowStaticInterfaceMethods;
- /** Switch: allow references to surrounding object from anonymous
- * objects during constructor call?
- */
- boolean allowAnonOuterThis;
-
/** Switch: generates a warning if diamond can be safely applied
* to a given new expression
*/
@@ -821,7 +790,7 @@
return types.createErrorType(t);
}
} else {
- t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics);
+ t = chk.checkClassType(tree.pos(), t, checkExtensible);
}
if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) {
log.error(tree.pos(), "intf.expected.here");
@@ -1262,9 +1231,7 @@
try {
- boolean enumSwitch =
- allowEnums &&
- (seltype.tsym.flags() & Flags.ENUM) != 0;
+ boolean enumSwitch = (seltype.tsym.flags() & Flags.ENUM) != 0;
boolean stringSwitch = false;
if (types.isSameType(seltype, syms.stringType)) {
if (allowStringsInSwitch) {
@@ -1554,9 +1521,9 @@
if (types.isSameType(thentype, elsetype))
return thentype.baseType();
- Type thenUnboxed = (!allowBoxing || thentype.isPrimitive())
+ Type thenUnboxed = (thentype.isPrimitive())
? thentype : types.unboxedType(thentype);
- Type elseUnboxed = (!allowBoxing || elsetype.isPrimitive())
+ Type elseUnboxed = (elsetype.isPrimitive())
? elsetype : types.unboxedType(elsetype);
// Otherwise, if both arms can be converted to a numeric
@@ -1588,19 +1555,17 @@
}
// Those were all the cases that could result in a primitive
- if (allowBoxing) {
- if (thentype.isPrimitive())
- thentype = types.boxedClass(thentype).type;
- if (elsetype.isPrimitive())
- elsetype = types.boxedClass(elsetype).type;
- }
+ if (thentype.isPrimitive())
+ thentype = types.boxedClass(thentype).type;
+ if (elsetype.isPrimitive())
+ elsetype = types.boxedClass(elsetype).type;
if (types.isSubtype(thentype, elsetype))
return elsetype.baseType();
if (types.isSubtype(elsetype, thentype))
return thentype.baseType();
- if (!allowBoxing || thentype.hasTag(VOID) || elsetype.hasTag(VOID)) {
+ if (thentype.hasTag(VOID) || elsetype.hasTag(VOID)) {
log.error(pos, "neither.conditional.subtype",
thentype, elsetype);
return thentype.baseType();
@@ -1853,7 +1818,7 @@
// if we're calling a java.lang.Enum constructor,
// prefix the implicit String and int parameters
- if (site.tsym == syms.enumSym && allowEnums)
+ if (site.tsym == syms.enumSym)
argtypes = argtypes.prepend(syms.intType).prepend(syms.stringType);
// Resolve the called constructor under the assumption
@@ -1932,15 +1897,11 @@
}
//where
Type adjustMethodReturnType(Type qualifierType, Name methodName, List<Type> argtypes, Type restype) {
- if (allowCovariantReturns &&
- methodName == names.clone &&
- types.isArray(qualifierType)) {
+ if (methodName == names.clone && types.isArray(qualifierType)) {
// as a special case, array.clone() has a result that is
// the same as static type of the array being cloned
return qualifierType;
- } else if (allowGenerics &&
- methodName == names.getClass &&
- argtypes.isEmpty()) {
+ } else if (methodName == names.getClass && argtypes.isEmpty()) {
// as a special case, x.getClass() has type Class<? extends |X|>
return new ClassType(restype.getEnclosingType(),
List.<Type>of(new WildcardType(types.erasure(qualifierType),
@@ -2133,10 +2094,9 @@
// If we have made no mistakes in the class type...
if (clazztype.hasTag(CLASS)) {
// Enums may not be instantiated except implicitly
- if (allowEnums &&
- (clazztype.tsym.flags_field&Flags.ENUM) != 0 &&
+ if ((clazztype.tsym.flags_field & Flags.ENUM) != 0 &&
(!env.tree.hasTag(VARDEF) ||
- (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 ||
+ (((JCVariableDecl) env.tree).mods.flags & Flags.ENUM) == 0 ||
((JCVariableDecl) env.tree).init != tree))
log.error(tree.pos(), "enum.cant.be.instantiated");
// Check that class is not abstract
@@ -3370,7 +3330,7 @@
while (symEnv.outer != null &&
!sym.isMemberOf(symEnv.enclClass.sym, types)) {
if ((symEnv.enclClass.sym.flags() & NOOUTERTHIS) != 0)
- noOuterThisPath = !allowAnonOuterThis;
+ noOuterThisPath = false;
symEnv = symEnv.outer;
}
}
@@ -3592,9 +3552,7 @@
// In this case, we have already made sure in
// visitSelect that qualifier expression is a type.
Type t = syms.classType;
- List<Type> typeargs = allowGenerics
- ? List.of(types.erasure(site))
- : List.<Type>nil();
+ List<Type> typeargs = List.of(types.erasure(site));
t = new ClassType(t.getEnclosingType(), typeargs, t.tsym);
return new VarSymbol(
STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
@@ -3774,8 +3732,7 @@
// Test (4): if symbol is an instance field of a raw type,
// which is being assigned to, issue an unchecked warning if
// its type changes under erasure.
- if (allowGenerics &&
- resultInfo.pkind == VAR &&
+ if (resultInfo.pkind == VAR &&
v.owner.kind == TYP &&
(v.flags() & STATIC) == 0 &&
(site.hasTag(CLASS) || site.hasTag(TYPEVAR))) {
@@ -3955,8 +3912,7 @@
List<Type> typeargtypes) {
// Test (5): if symbol is an instance method of a raw type, issue
// an unchecked warning if its argument types change under erasure.
- if (allowGenerics &&
- (sym.flags() & STATIC) == 0 &&
+ if ((sym.flags() & STATIC) == 0 &&
(site.hasTag(CLASS) || site.hasTag(TYPEVAR))) {
Type s = types.asOuterSuper(site, sym.owner);
if (s != null && s.isRaw() &&
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 10 13:57:27 2014 -0700
@@ -124,10 +124,6 @@
fileManager = context.get(JavaFileManager.class);
Source source = Source.instance(context);
- allowGenerics = source.allowGenerics();
- allowVarargs = source.allowVarargs();
- allowAnnotations = source.allowAnnotations();
- allowCovariantReturns = source.allowCovariantReturns();
allowSimplifiedVarargs = source.allowSimplifiedVarargs();
allowDefaultMethods = source.allowDefaultMethods();
allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
@@ -146,7 +142,7 @@
boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
- boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();
+ boolean enforceMandatoryWarnings = true;
deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
@@ -158,22 +154,6 @@
deferredLintHandler = DeferredLintHandler.instance(context);
}
- /** Switch: generics enabled?
- */
- boolean allowGenerics;
-
- /** Switch: varargs enabled?
- */
- boolean allowVarargs;
-
- /** Switch: annotations enabled?
- */
- boolean allowAnnotations;
-
- /** Switch: covariant returns enabled?
- */
- boolean allowCovariantReturns;
-
/** Switch: simplified varargs enabled?
*/
boolean allowSimplifiedVarargs;
@@ -903,8 +883,7 @@
assertConvertible(arg, arg.type, varArg, warn);
args = args.tail;
}
- } else if ((sym.flags() & (VARARGS | SIGNATURE_POLYMORPHIC)) == VARARGS &&
- allowVarargs) {
+ } else if ((sym.flags() & (VARARGS | SIGNATURE_POLYMORPHIC)) == VARARGS) {
// non-varargs call to varargs method
Type varParam = owntype.getParameterTypes().last();
Type lastArg = argtypes.last();
@@ -1671,18 +1650,12 @@
boolean resultTypesOK =
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
- if (!allowCovariantReturns &&
- m.owner != origin &&
- m.owner.isSubClass(other.owner, types)) {
- // allow limited interoperability with covariant returns
- } else {
- log.error(TreeInfo.diagnosticPositionFor(m, tree),
- "override.incompatible.ret",
- cannotOverride(m, other),
- mtres, otres);
- m.flags_field |= BAD_OVERRIDE;
- return;
- }
+ log.error(TreeInfo.diagnosticPositionFor(m, tree),
+ "override.incompatible.ret",
+ cannotOverride(m, other),
+ mtres, otres);
+ m.flags_field |= BAD_OVERRIDE;
+ return;
} else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
"override.unchecked.ret",
@@ -1819,13 +1792,6 @@
*/
public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
Type t1,
- Type t2) {
- return checkCompatibleAbstracts(pos, t1, t2,
- types.makeCompoundType(t1, t2));
- }
-
- public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
- Type t1,
Type t2,
Type site) {
if ((site.tsym.flags() & COMPOUND) != 0) {
@@ -2321,7 +2287,7 @@
void checkImplementations(JCTree tree, ClassSymbol origin, ClassSymbol ic) {
for (List<Type> l = types.closure(ic.type); l.nonEmpty(); l = l.tail) {
ClassSymbol lc = (ClassSymbol)l.head.tsym;
- if ((allowGenerics || origin != lc) && (lc.flags() & ABSTRACT) != 0) {
+ if ((lc.flags() & ABSTRACT) != 0) {
for (Symbol sym : lc.members().getSymbols(NON_RECURSIVE)) {
if (sym.kind == MTH &&
(sym.flags() & (STATIC|ABSTRACT)) == ABSTRACT) {
@@ -2356,7 +2322,7 @@
(supertype.tsym.flags() & ABSTRACT) != 0)
supertypes = supertypes.prepend(supertype);
for (List<Type> l = supertypes; l.nonEmpty(); l = l.tail) {
- if (allowGenerics && !l.head.getTypeArguments().isEmpty() &&
+ if (!l.head.getTypeArguments().isEmpty() &&
!checkCompatibleAbstracts(pos, l.head, l.head, c))
return;
for (List<Type> m = supertypes; m != l; m = m.tail)
@@ -3204,8 +3170,7 @@
}
void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) {
- if (allowAnnotations &&
- lint.isEnabled(LintCategory.DEP_ANN) &&
+ if (lint.isEnabled(LintCategory.DEP_ANN) &&
(s.flags() & DEPRECATED) != 0 &&
!syms.deprecatedType.isErroneous() &&
s.attribute(syms.deprecatedType.tsym) == null) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Jul 10 13:57:27 2014 -0700
@@ -82,7 +82,6 @@
private final Target target;
private final Source source;
private final TypeEnvs typeEnvs;
- private final boolean allowEnums;
private final Name dollarAssertionsDisabled;
private final Name classDollar;
private final Types types;
@@ -103,7 +102,6 @@
target = Target.instance(context);
source = Source.instance(context);
typeEnvs = TypeEnvs.instance(context);
- allowEnums = source.allowEnums();
dollarAssertionsDisabled = names.
fromString(target.syntheticNameChar() + "assertionsDisabled");
classDollar = names.
@@ -1492,9 +1490,6 @@
List<JCVariableDecl> freevarDefs(int pos, List<VarSymbol> freevars, Symbol owner,
long additionalFlags) {
long flags = FINAL | SYNTHETIC | additionalFlags;
- if (owner.kind == TYP &&
- target.usePrivateSyntheticFields())
- flags |= PRIVATE;
List<JCVariableDecl> defs = List.nil();
for (List<VarSymbol> l = freevars; l.nonEmpty(); l = l.tail) {
VarSymbol v = l.head;
@@ -1525,9 +1520,6 @@
}
private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) {
- if (owner.kind == TYP &&
- target.usePrivateSyntheticFields())
- flags |= PRIVATE;
Type target = types.erasure(owner.enclClass().type.getEnclosingType());
VarSymbol outerThis =
new VarSymbol(flags, outerThisName(target, owner), target, owner);
@@ -1900,8 +1892,6 @@
*/
private ClassSymbol outerCacheClass() {
ClassSymbol clazz = outermostClassDef.sym;
- if ((clazz.flags() & INTERFACE) == 0 &&
- !target.useInnerCacheClass()) return clazz;
Scope s = clazz.members();
for (Symbol sym : s.getSymbols(NON_RECURSIVE))
if (sym.kind == TYP &&
@@ -1958,79 +1948,54 @@
JCBlock returnResult;
- // in 1.4.2 and above, we use
- // Class.forName(String name, boolean init, ClassLoader loader);
- // which requires we cache the current loader in cl$
- if (target.classLiteralsNoInit()) {
- // clsym = "private static ClassLoader cl$"
- VarSymbol clsym = new VarSymbol(STATIC|SYNTHETIC,
- names.fromString("cl" + target.syntheticNameChar()),
- syms.classLoaderType,
- outerCacheClass);
- enterSynthetic(pos, clsym, outerCacheClass.members());
-
- // emit "private static ClassLoader cl$;"
- JCVariableDecl cldef = make.VarDef(clsym, null);
- JCClassDecl outerCacheClassDef = classDef(outerCacheClass);
- outerCacheClassDef.defs = outerCacheClassDef.defs.prepend(cldef);
-
- // newcache := "new cache$1[0]"
- JCNewArray newcache = make.
- NewArray(make.Type(outerCacheClass.type),
- List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
- null);
- newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
- syms.arrayClass, Type.noAnnotations);
-
- // forNameSym := java.lang.Class.forName(
- // String s,boolean init,ClassLoader loader)
- Symbol forNameSym = lookupMethod(make_pos, names.forName,
- types.erasure(syms.classType),
- List.of(syms.stringType,
- syms.booleanType,
- syms.classLoaderType));
- // clvalue := "(cl$ == null) ?
- // $newcache.getClass().getComponentType().getClassLoader() : cl$"
- JCExpression clvalue =
+ // cache the current loader in cl$
+ // clsym = "private static ClassLoader cl$"
+ VarSymbol clsym = new VarSymbol(STATIC | SYNTHETIC,
+ names.fromString("cl" + target.syntheticNameChar()),
+ syms.classLoaderType,
+ outerCacheClass);
+ enterSynthetic(pos, clsym, outerCacheClass.members());
+
+ // emit "private static ClassLoader cl$;"
+ JCVariableDecl cldef = make.VarDef(clsym, null);
+ JCClassDecl outerCacheClassDef = classDef(outerCacheClass);
+ outerCacheClassDef.defs = outerCacheClassDef.defs.prepend(cldef);
+
+ // newcache := "new cache$1[0]"
+ JCNewArray newcache = make.NewArray(make.Type(outerCacheClass.type),
+ List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
+ null);
+ newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
+ syms.arrayClass, Type.noAnnotations);
+
+ // forNameSym := java.lang.Class.forName(
+ // String s,boolean init,ClassLoader loader)
+ Symbol forNameSym = lookupMethod(make_pos, names.forName,
+ types.erasure(syms.classType),
+ List.of(syms.stringType,
+ syms.booleanType,
+ syms.classLoaderType));
+ // clvalue := "(cl$ == null) ?
+ // $newcache.getClass().getComponentType().getClassLoader() : cl$"
+ JCExpression clvalue =
make.Conditional(
- makeBinary(EQ, make.Ident(clsym), makeNull()),
- make.Assign(
- make.Ident(clsym),
- makeCall(
- makeCall(makeCall(newcache,
- names.getClass,
- List.<JCExpression>nil()),
- names.getComponentType,
- List.<JCExpression>nil()),
- names.getClassLoader,
- List.<JCExpression>nil())).setType(syms.classLoaderType),
- make.Ident(clsym)).setType(syms.classLoaderType);
-
- // returnResult := "{ return Class.forName(param1, false, cl$); }"
- List<JCExpression> args = List.of(make.Ident(md.params.head.sym),
- makeLit(syms.booleanType, 0),
- clvalue);
- returnResult = make.
- Block(0, List.<JCStatement>of(make.
- Call(make. // return
- App(make.
- Ident(forNameSym), args))));
- } else {
- // forNameSym := java.lang.Class.forName(String s)
- Symbol forNameSym = lookupMethod(make_pos,
- names.forName,
- types.erasure(syms.classType),
- List.of(syms.stringType));
- // returnResult := "{ return Class.forName(param1); }"
- returnResult = make.
- Block(0, List.of(make.
- Call(make. // return
- App(make.
- QualIdent(forNameSym),
- List.<JCExpression>of(make.
- Ident(md.params.
- head.sym))))));
- }
+ makeBinary(EQ, make.Ident(clsym), makeNull()),
+ make.Assign(make.Ident(clsym),
+ makeCall(
+ makeCall(makeCall(newcache,
+ names.getClass,
+ List.<JCExpression>nil()),
+ names.getComponentType,
+ List.<JCExpression>nil()),
+ names.getClassLoader,
+ List.<JCExpression>nil())).setType(syms.classLoaderType),
+ make.Ident(clsym)).setType(syms.classLoaderType);
+
+ // returnResult := "{ return Class.forName(param1, false, cl$); }"
+ List<JCExpression> args = List.of(make.Ident(md.params.head.sym),
+ makeLit(syms.booleanType, 0),
+ clvalue);
+ returnResult = make.Block(0, List.<JCStatement>of(make.Call(make.App(make.Ident(forNameSym), args))));
// catchParam := ClassNotFoundException e1
VarSymbol catchParam =
@@ -2039,27 +2004,13 @@
classDollarSym);
JCStatement rethrow;
- if (target.hasInitCause()) {
- // rethrow = "throw new NoClassDefFoundError().initCause(e);
- JCExpression throwExpr =
- makeCall(makeNewClass(syms.noClassDefFoundErrorType,
- List.<JCExpression>nil()),
- names.initCause,
- List.<JCExpression>of(make.Ident(catchParam)));
- rethrow = make.Throw(throwExpr);
- } else {
- // getMessageSym := ClassNotFoundException.getMessage()
- Symbol getMessageSym = lookupMethod(make_pos,
- names.getMessage,
- syms.classNotFoundExceptionType,
- List.<Type>nil());
- // rethrow = "throw new NoClassDefFoundError(e.getMessage());"
- rethrow = make.
- Throw(makeNewClass(syms.noClassDefFoundErrorType,
- List.<JCExpression>of(make.App(make.Select(make.Ident(catchParam),
- getMessageSym),
- List.<JCExpression>nil()))));
- }
+ // rethrow = "throw new NoClassDefFoundError().initCause(e);
+ JCExpression throwExpr =
+ makeCall(makeNewClass(syms.noClassDefFoundErrorType,
+ List.<JCExpression>nil()),
+ names.initCause,
+ List.<JCExpression>of(make.Ident(catchParam)));
+ rethrow = make.Throw(throwExpr);
// rethrowStmt := "( $rethrow )"
JCBlock rethrowStmt = make.Block(0, List.of(rethrow));
@@ -2147,29 +2098,10 @@
((VarSymbol)typeSym).getConstValue(); // ensure initializer is evaluated
return make.QualIdent(typeSym);
case CLASS: case ARRAY:
- if (target.hasClassLiterals()) {
VarSymbol sym = new VarSymbol(
STATIC | PUBLIC | FINAL, names._class,
syms.classType, type.tsym);
return make_at(pos).Select(make.Type(type), sym);
- }
- // replace with <cache == null ? cache = class$(tsig) : cache>
- // where
- // - <tsig> is the type signature of T,
- // - <cache> is the cache variable for tsig.
- String sig =
- writer.xClassName(type).toString().replace('/', '.');
- Symbol cs = cacheSym(pos, sig);
- return make_at(pos).Conditional(
- makeBinary(EQ, make.Ident(cs), makeNull()),
- make.Assign(
- make.Ident(cs),
- make.App(
- make.Ident(classDollarSym(pos)),
- List.<JCExpression>of(make.Literal(CLASS, sig)
- .setType(syms.stringType))))
- .setType(types.erasure(syms.classType)),
- make.Ident(cs)).setType(types.erasure(syms.classType));
default:
throw new AssertionError();
}
@@ -2415,9 +2347,8 @@
Name name = names.package_info;
long flags = Flags.ABSTRACT | Flags.INTERFACE;
- if (target.isPackageInfoSynthetic())
- // package-info is marked SYNTHETIC in JDK 1.6 and later releases
- flags = flags | Flags.SYNTHETIC;
+ // package-info is marked SYNTHETIC in JDK 1.6 and later releases
+ flags = flags | Flags.SYNTHETIC;
JCClassDecl packageAnnotationsClass
= make.ClassDef(make.Modifiers(flags, tree.getAnnotations()),
name, List.<JCTypeParameter>nil(),
@@ -2549,8 +2480,7 @@
if (tree.extending == null)
tree.extending = make.Type(types.supertype(tree.type));
- // classOfType adds a cache field to tree.defs unless
- // target.hasClassLiterals().
+ // classOfType adds a cache field to tree.defs
JCExpression e_class = classOfType(tree.sym.type, tree.pos()).
setType(types.erasure(syms.classType));
@@ -2810,11 +2740,7 @@
// recursively translate following local statements and
// combine with this- or super-call
List<JCStatement> stats = translate(tree.body.stats.tail);
- if (target.initializeFieldsBeforeSuper())
- tree.body.stats = stats.prepend(selfCall).prependList(added);
- else
- tree.body.stats = stats.prependList(added).prepend(selfCall);
-
+ tree.body.stats = stats.prepend(selfCall).prependList(added);
outerThisStack = prevOuterThisStack;
} else {
Map<Symbol, Symbol> prevLambdaTranslationMap =
@@ -3056,9 +2982,7 @@
public void visitApply(JCMethodInvocation tree) {
Symbol meth = TreeInfo.symbol(tree.meth);
List<Type> argtypes = meth.type.getParameterTypes();
- if (allowEnums &&
- meth.name==names.init &&
- meth.owner == syms.enumSym)
+ if (meth.name == names.init && meth.owner == syms.enumSym)
argtypes = argtypes.tail.tail;
tree.args = boxArgs(argtypes, tree.args, tree.varargsElement);
tree.varargsElement = null;
@@ -3195,20 +3119,12 @@
/** Box up a single primitive expression. */
JCExpression boxPrimitive(JCExpression tree, Type box) {
make_at(tree.pos());
- if (target.boxWithConstructors()) {
- Symbol ctor = lookupConstructor(tree.pos(),
- box,
- List.<Type>nil()
- .prepend(tree.type));
- return make.Create(ctor, List.of(tree));
- } else {
- Symbol valueOfSym = lookupMethod(tree.pos(),
- names.valueOf,
- box,
- List.<Type>nil()
- .prepend(tree.type));
- return make.App(make.QualIdent(valueOfSym), List.of(tree));
- }
+ Symbol valueOfSym = lookupMethod(tree.pos(),
+ names.valueOf,
+ box,
+ List.<Type>nil()
+ .prepend(tree.type));
+ return make.App(make.QualIdent(valueOfSym), List.of(tree));
}
/** Unbox an object to a primitive value. */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jul 10 13:57:27 2014 -0700
@@ -54,11 +54,9 @@
import java.util.Arrays;
import java.util.Collection;
-import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.Map;
import javax.lang.model.element.ElementVisitor;
@@ -92,8 +90,6 @@
TreeInfo treeinfo;
Types types;
JCDiagnostic.Factory diags;
- public final boolean boxingEnabled;
- public final boolean varargsEnabled;
public final boolean allowMethodHandles;
public final boolean allowFunctionalInterfaceMostSpecific;
public final boolean checkVarargsAccessAfterResolution;
@@ -128,8 +124,6 @@
types = Types.instance(context);
diags = JCDiagnostic.Factory.instance(context);
Source source = Source.instance(context);
- boxingEnabled = source.allowBoxing();
- varargsEnabled = source.allowVarargs();
Options options = Options.instance(context);
debugResolve = options.isSet("debugresolve");
compactMethodDiags = options.isSet(Option.XDIAGS, "compact") ||
@@ -3279,8 +3273,8 @@
Symbol bestSoFar = methodNotFound;
currentResolutionContext = resolveContext;
for (MethodResolutionPhase phase : methodResolutionSteps) {
- if (!phase.isApplicable(boxingEnabled, varargsEnabled) ||
- lookupHelper.shouldStop(bestSoFar, phase)) break;
+ if (lookupHelper.shouldStop(bestSoFar, phase))
+ break;
MethodResolutionPhase prevPhase = currentResolutionContext.step;
Symbol prevBest = bestSoFar;
currentResolutionContext.step = phase;
@@ -4208,11 +4202,6 @@
return isVarargsRequired;
}
- public boolean isApplicable(boolean boxingEnabled, boolean varargsEnabled) {
- return (varargsEnabled || !isVarargsRequired) &&
- (boxingEnabled || !isBoxingRequired);
- }
-
public Symbol mergeResults(Symbol prev, Symbol sym) {
return sym;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Jul 10 13:57:27 2014 -0700
@@ -67,18 +67,10 @@
private Symtab syms;
private TreeMaker make;
private Enter enter;
- private boolean allowEnums;
private boolean allowInterfaceBridges;
private Types types;
private final Resolve resolve;
- /**
- * Flag to indicate whether or not to generate bridge methods.
- * For pre-Tiger source there is no need for bridge methods, so it
- * can be skipped to get better performance for -source 1.4 etc.
- */
- private final boolean addBridges;
-
private final CompileStates compileStates;
protected TransTypes(Context context) {
@@ -90,8 +82,6 @@
enter = Enter.instance(context);
overridden = new HashMap<>();
Source source = Source.instance(context);
- allowEnums = source.allowEnums();
- addBridges = source.addBridges();
allowInterfaceBridges = source.allowDefaultMethods();
types = Types.instance(context);
make = TreeMaker.instance(context);
@@ -665,9 +655,7 @@
Symbol meth = TreeInfo.symbol(tree.meth);
Type mt = meth.erasure(types);
List<Type> argtypes = mt.getParameterTypes();
- if (allowEnums &&
- meth.name==names.init &&
- meth.owner == syms.enumSym)
+ if (meth.name == names.init && meth.owner == syms.enumSym)
argtypes = argtypes.tail.tail;
if (tree.varargsElement != null)
tree.varargsElement = types.erasure(tree.varargsElement);
@@ -920,13 +908,11 @@
tree.typarams = List.nil();
super.visitClassDef(tree);
make.at(tree.pos);
- if (addBridges) {
- ListBuffer<JCTree> bridges = new ListBuffer<>();
- if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
- addBridges(tree.pos(), c, bridges);
- }
- tree.defs = bridges.toList().prependList(tree.defs);
+ ListBuffer<JCTree> bridges = new ListBuffer<>();
+ if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
+ addBridges(tree.pos(), c, bridges);
}
+ tree.defs = bridges.toList().prependList(tree.defs);
tree.type = erasure(tree.type);
} finally {
make = savedMake;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Jul 10 13:57:27 2014 -0700
@@ -91,18 +91,6 @@
*/
public boolean readAllOfClassFile = false;
- /** Switch: read GJ signature information.
- */
- boolean allowGenerics;
-
- /** Switch: read varargs attribute.
- */
- boolean allowVarargs;
-
- /** Switch: allow annotations.
- */
- boolean allowAnnotations;
-
/** Switch: allow simplified varargs.
*/
boolean allowSimplifiedVarargs;
@@ -223,9 +211,6 @@
checkClassFile = options.isSet("-checkclassfile");
Source source = Source.instance(context);
- allowGenerics = source.allowGenerics();
- allowVarargs = source.allowVarargs();
- allowAnnotations = source.allowAnnotations();
allowSimplifiedVarargs = source.allowSimplifiedVarargs();
saveParameterNames = options.isSet("save-parameter-names");
@@ -1026,9 +1011,7 @@
new AttributeReader(names.Synthetic, V45_3, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- // bridge methods are visible when generics not enabled
- if (allowGenerics || (sym.flags_field & BRIDGE) == 0)
- sym.flags_field |= SYNTHETIC;
+ sym.flags_field |= SYNTHETIC;
}
},
@@ -1043,11 +1026,6 @@
},
new AttributeReader(names.Signature, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
- @Override
- protected boolean accepts(AttributeKind kind) {
- return super.accepts(kind) && allowGenerics;
- }
-
protected void read(Symbol sym, int attrLen) {
if (sym.kind == TYP) {
ClassSymbol c = (ClassSymbol) sym;
@@ -1110,16 +1088,13 @@
new AttributeReader(names.Annotation, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- if (allowAnnotations)
- sym.flags_field |= ANNOTATION;
+ sym.flags_field |= ANNOTATION;
}
},
new AttributeReader(names.Bridge, V49, MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
sym.flags_field |= BRIDGE;
- if (!allowGenerics)
- sym.flags_field &= ~SYNTHETIC;
}
},
@@ -1131,8 +1106,7 @@
new AttributeReader(names.Varargs, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- if (allowVarargs)
- sym.flags_field |= VARARGS;
+ sym.flags_field |= VARARGS;
}
},
@@ -2413,8 +2387,6 @@
if ((flags & ACC_BRIDGE) != 0) {
flags &= ~ACC_BRIDGE;
flags |= BRIDGE;
- if (!allowGenerics)
- flags &= ~SYNTHETIC;
}
if ((flags & ACC_VARARGS) != 0) {
flags &= ~ACC_VARARGS;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Jul 10 13:57:27 2014 -0700
@@ -51,7 +51,6 @@
import static com.sun.tools.javac.code.Kinds.*;
import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
import static com.sun.tools.javac.code.TypeTag.*;
-import static com.sun.tools.javac.jvm.UninitializedType.*;
import static com.sun.tools.javac.main.Option.*;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
@@ -543,8 +542,6 @@
* Returns the number of attributes written (0 or 1).
*/
int writeEnclosingMethodAttribute(ClassSymbol c) {
- if (!target.hasEnclosingMethodAttribute())
- return 0;
return writeEnclosingMethodAttribute(names.EnclosingMethod, c);
}
@@ -578,31 +575,6 @@
endAttr(alenIdx);
acount++;
}
- if ((flags & ENUM) != 0 && !target.useEnumFlag()) {
- int alenIdx = writeAttr(names.Enum);
- endAttr(alenIdx);
- acount++;
- }
- if ((flags & SYNTHETIC) != 0 && !target.useSyntheticFlag()) {
- int alenIdx = writeAttr(names.Synthetic);
- endAttr(alenIdx);
- acount++;
- }
- if ((flags & BRIDGE) != 0 && !target.useBridgeFlag()) {
- int alenIdx = writeAttr(names.Bridge);
- endAttr(alenIdx);
- acount++;
- }
- if ((flags & VARARGS) != 0 && !target.useVarargsFlag()) {
- int alenIdx = writeAttr(names.Varargs);
- endAttr(alenIdx);
- acount++;
- }
- if ((flags & ANNOTATION) != 0 && !target.useAnnotationFlag()) {
- int alenIdx = writeAttr(names.Annotation);
- endAttr(alenIdx);
- acount++;
- }
return acount;
}
@@ -612,11 +584,10 @@
int writeMemberAttrs(Symbol sym) {
int acount = writeFlagAttrs(sym.flags());
long flags = sym.flags();
- if (source.allowGenerics() &&
- (flags & (SYNTHETIC|BRIDGE)) != SYNTHETIC &&
+ if ((flags & (SYNTHETIC | BRIDGE)) != SYNTHETIC &&
(flags & ANONCONSTR) == 0 &&
(!types.isSameType(sym.type, sym.erasure(types)) ||
- signatureGen.hasTypeVar(sym.type.getThrownTypes()))) {
+ signatureGen.hasTypeVar(sym.type.getThrownTypes()))) {
// note that a local class with captured variables
// will get a signature attribute
int alenIdx = writeAttr(names.Signature);
@@ -1252,14 +1223,14 @@
// output locals
int localCount = 0;
for (int j=0; j<frame.locals.length;
- j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.locals[j]))) {
+ j += Code.width(frame.locals[j])) {
localCount++;
}
if (debugstackmap) System.out.print(" nlocals=" +
localCount);
databuf.appendChar(localCount);
for (int j=0; j<frame.locals.length;
- j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.locals[j]))) {
+ j += Code.width(frame.locals[j])) {
if (debugstackmap) System.out.print(" local[" + j + "]=");
writeStackMapType(frame.locals[j]);
}
@@ -1267,14 +1238,14 @@
// output stack
int stackCount = 0;
for (int j=0; j<frame.stack.length;
- j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.stack[j]))) {
+ j += Code.width(frame.stack[j])) {
stackCount++;
}
if (debugstackmap) System.out.print(" nstack=" +
stackCount);
databuf.appendChar(stackCount);
for (int j=0; j<frame.stack.length;
- j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.stack[j]))) {
+ j += Code.width(frame.stack[j])) {
if (debugstackmap) System.out.print(" stack[" + j + "]=");
writeStackMapType(frame.stack[j]);
}
@@ -1684,7 +1655,6 @@
for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
sigReq = l.head.allparams().length() != 0;
if (sigReq) {
- Assert.check(source.allowGenerics());
int alenIdx = writeAttr(names.Signature);
if (typarams.length() != 0) signatureGen.assembleParamsSig(typarams);
signatureGen.assembleSig(supertype);
@@ -1761,16 +1731,10 @@
int adjustFlags(final long flags) {
int result = (int)flags;
- if ((flags & SYNTHETIC) != 0 && !target.useSyntheticFlag())
- result &= ~SYNTHETIC;
- if ((flags & ENUM) != 0 && !target.useEnumFlag())
- result &= ~ENUM;
- if ((flags & ANNOTATION) != 0 && !target.useAnnotationFlag())
- result &= ~ANNOTATION;
- if ((flags & BRIDGE) != 0 && target.useBridgeFlag())
+ if ((flags & BRIDGE) != 0)
result |= ACC_BRIDGE;
- if ((flags & VARARGS) != 0 && target.useVarargsFlag())
+ if ((flags & VARARGS) != 0)
result |= ACC_VARARGS;
if ((flags & DEFAULT) != 0)
result &= ~ABSTRACT;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jul 10 13:57:27 2014 -0700
@@ -75,13 +75,6 @@
private final Types types;
private final Lower lower;
- /** Switch: GJ mode?
- */
- private final boolean allowGenerics;
-
- /** Set when Miranda method stubs are to be generated. */
- private final boolean generateIproxies;
-
/** Format of stackmap tables to be generated. */
private final Code.StackMapFormat stackMap;
@@ -116,10 +109,7 @@
target = Target.instance(context);
types = Types.instance(context);
methodType = new MethodType(null, null, null, syms.methodClass);
- allowGenerics = Source.instance(context).allowGenerics();
- stringBufferType = target.useStringBuilder()
- ? syms.stringBuilderType
- : syms.stringBufferType;
+ stringBufferType = syms.stringBuilderType;
stringBufferAppend = new HashMap<>();
accessDollar = names.
fromString("access" + target.syntheticNameChar());
@@ -141,20 +131,8 @@
allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
pool = new Pool(types);
- generateIproxies =
- target.requiresIproxy() ||
- options.isSet("miranda");
-
- if (target.generateStackMapTable()) {
- // ignore cldc because we cannot have both stackmap formats
- this.stackMap = StackMapFormat.JSR202;
- } else {
- if (target.generateCLDCStackmap()) {
- this.stackMap = StackMapFormat.CLDC;
- } else {
- this.stackMap = StackMapFormat.NONE;
- }
- }
+ // ignore cldc because we cannot have both stackmap formats
+ this.stackMap = StackMapFormat.JSR202;
// by default, avoid jsr's for simple finalizers
int setjsrlimit = 50;
@@ -275,10 +253,8 @@
sym.owner != syms.arrayClass)
return sym;
// array clone can be qualified by the array type in later targets
- Symbol qualifier = target.arrayBinaryCompatibility()
- ? new ClassSymbol(Flags.PUBLIC, site.tsym.name,
- site, syms.noSymbol)
- : syms.objectType.tsym;
+ Symbol qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name,
+ site, syms.noSymbol);
return sym.clone(qualifier);
}
@@ -286,27 +262,12 @@
(sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) {
return sym;
}
- if (!target.obeyBinaryCompatibility())
- return rs.isAccessible(attrEnv, (TypeSymbol)sym.owner)
- ? sym
- : sym.clone(site.tsym);
-
- if (!target.interfaceFieldsBinaryCompatibility()) {
- if ((sym.owner.flags() & INTERFACE) != 0 && sym.kind == VAR)
- return sym;
- }
// leave alone methods inherited from Object
// JLS 13.1.
if (sym.owner == syms.objectType.tsym)
return sym;
- if (!target.interfaceObjectOverridesBinaryCompatibility()) {
- if ((sym.owner.flags() & INTERFACE) != 0 &&
- syms.objectType.tsym.members().findFirst(sym.name) != null)
- return sym;
- }
-
return sym.clone(site.tsym);
}
@@ -626,75 +587,6 @@
}
}
-/* ********************************************************************
- * Adding miranda methods
- *********************************************************************/
-
- /** Add abstract methods for all methods defined in one of
- * the interfaces of a given class,
- * provided they are not already implemented in the class.
- *
- * @param c The class whose interfaces are searched for methods
- * for which Miranda methods should be added.
- */
- void implementInterfaceMethods(ClassSymbol c) {
- implementInterfaceMethods(c, c);
- }
-
- /** Add abstract methods for all methods defined in one of
- * the interfaces of a given class,
- * provided they are not already implemented in the class.
- *
- * @param c The class whose interfaces are searched for methods
- * for which Miranda methods should be added.
- * @param site The class in which a definition may be needed.
- */
- void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) {
- for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) {
- ClassSymbol i = (ClassSymbol)l.head.tsym;
- for (Symbol sym : i.members().getSymbols(NON_RECURSIVE)) {
- if (sym.kind == MTH && (sym.flags() & STATIC) == 0)
- {
- MethodSymbol absMeth = (MethodSymbol)sym;
- MethodSymbol implMeth = absMeth.binaryImplementation(site, types);
- if (implMeth == null)
- addAbstractMethod(site, absMeth);
- else if ((implMeth.flags() & IPROXY) != 0)
- adjustAbstractMethod(site, implMeth, absMeth);
- }
- }
- implementInterfaceMethods(i, site);
- }
- }
-
- /** Add an abstract methods to a class
- * which implicitly implements a method defined in some interface
- * implemented by the class. These methods are called "Miranda methods".
- * Enter the newly created method into its enclosing class scope.
- * Note that it is not entered into the class tree, as the emitter
- * doesn't need to see it there to emit an abstract method.
- *
- * @param c The class to which the Miranda method is added.
- * @param m The interface method symbol for which a Miranda method
- * is added.
- */
- private void addAbstractMethod(ClassSymbol c,
- MethodSymbol m) {
- MethodSymbol absMeth = new MethodSymbol(
- m.flags() | IPROXY | SYNTHETIC, m.name,
- m.type, // was c.type.memberType(m), but now only !generics supported
- c);
- c.members().enter(absMeth); // add to symbol table
- }
-
- private void adjustAbstractMethod(ClassSymbol c,
- MethodSymbol pm,
- MethodSymbol im) {
- MethodType pmt = (MethodType)pm.type;
- Type imt = types.memberType(c.type, im);
- pmt.thrown = chk.intersect(pmt.getThrownTypes(), imt.getThrownTypes());
- }
-
/* ************************************************************************
* Traversal methods
*************************************************************************/
@@ -1689,13 +1581,8 @@
code.addCatch(startpc1, endpc1, handler_pc1,
(char)catch_type);
} else {
- if (!useJsrLocally && !target.generateStackMapTable()) {
- useJsrLocally = true;
- throw new CodeSizeOverflow();
- } else {
- log.error(pos, "limit.code.too.large.for.try.stmt");
- nerrs++;
- }
+ log.error(pos, "limit.code.too.large.for.try.stmt");
+ nerrs++;
}
}
@@ -2361,7 +2248,6 @@
Symbol sym = tree.sym;
if (tree.name == names._class) {
- Assert.check(target.hasClassLiterals());
code.emitLdc(makeRef(tree.pos(), tree.selected.type));
result = items.makeStackItem(pt);
return;
@@ -2472,13 +2358,6 @@
ClassSymbol c = cdef.sym;
this.toplevel = env.toplevel;
this.endPosTable = toplevel.endPositions;
- // If this is a class definition requiring Miranda methods,
- // add them.
- if (generateIproxies &&
- (c.flags() & (INTERFACE|ABSTRACT)) == ABSTRACT
- && !allowGenerics // no Miranda methods available with generics
- )
- implementInterfaceMethods(c);
cdef.defs = normalizeDefs(cdef.defs, c);
c.pool = pool;
pool.reset();
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,11 +77,9 @@
return instance;
}
- private static final Target MIN = values()[0];
- public static Target MIN() { return MIN; }
+ public static final Target MIN = Target.JDK1_6;
private static final Target MAX = values()[values().length - 1];
- public static Target MAX() { return MAX; }
private static final Map<String,Target> tab = new HashMap<>();
static {
@@ -110,132 +108,6 @@
return tab.get(name);
}
- /** In -target 1.1 and earlier, the compiler is required to emit
- * synthetic method definitions in abstract classes for interface
- * methods that are not overridden. We call them "Miranda" methods.
- */
- public boolean requiresIproxy() {
- return compareTo(JDK1_1) <= 0;
- }
-
- /** Beginning in 1.4, we take advantage of the possibility of emitting
- * code to initialize fields before calling the superclass constructor.
- * This is allowed by the VM spec, but the verifier refused to allow
- * it until 1.4. This is necesary to translate some code involving
- * inner classes. See, for example, 4030374.
- */
- public boolean initializeFieldsBeforeSuper() {
- return compareTo(JDK1_4) >= 0;
- }
-
- /** Beginning with -target 1.2 we obey the JLS rules for binary
- * compatibility, emitting as the qualifying type of a reference
- * to a method or field the type of the qualifier. In earlier
- * targets we use as the qualifying type the class in which the
- * member was found. The following methods named
- * *binaryCompatibility() indicate places where we vary from this
- * general rule. */
- public boolean obeyBinaryCompatibility() {
- return compareTo(JDK1_2) >= 0;
- }
-
- /** Starting in 1.5, the compiler uses an array type as
- * the qualifier for method calls (such as clone) where required by
- * the language and VM spec. Earlier versions of the compiler
- * qualified them by Object.
- */
- public boolean arrayBinaryCompatibility() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** Beginning after 1.2, we follow the binary compatibility rules for
- * interface fields. The 1.2 VMs had bugs handling interface fields
- * when compiled using binary compatibility (see 4400598), so this is
- * an accommodation to them.
- */
- public boolean interfaceFieldsBinaryCompatibility() {
- return compareTo(JDK1_2) > 0;
- }
-
- /** Beginning in -target 1.5, we follow the binary compatibility
- * rules for interface methods that redefine Object methods.
- * Earlier VMs had bugs handling such methods compiled using binary
- * compatibility (see 4392595, 4398791, 4392595, 4400415).
- * The VMs were fixed during or soon after 1.4. See 4392595.
- */
- public boolean interfaceObjectOverridesBinaryCompatibility() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** Beginning in -target 1.5, we make synthetic variables
- * package-private instead of private. This is to prevent the
- * necessity of access methods, which effectively relax the
- * protection of the field but bloat the class files and affect
- * execution.
- */
- public boolean usePrivateSyntheticFields() {
- return compareTo(JDK1_5) < 0;
- }
-
- /** Sometimes we need to create a field to cache a value like a
- * class literal of the assertions flag. In -target 1.5 and
- * later we create a new synthetic class for this instead of
- * using the outermost class. See 4401576.
- */
- public boolean useInnerCacheClass() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** Return true if cldc-style stack maps need to be generated. */
- public boolean generateCLDCStackmap() {
- return false;
- }
-
- /** Beginning in -target 6, we generate stackmap attribute in
- * compact format. */
- public boolean generateStackMapTable() {
- return compareTo(JDK1_6) >= 0;
- }
-
- /** Beginning in -target 6, package-info classes are marked synthetic.
- */
- public boolean isPackageInfoSynthetic() {
- return compareTo(JDK1_6) >= 0;
- }
-
- /** Do we generate "empty" stackmap slots after double and long?
- */
- public boolean generateEmptyAfterBig() {
- return false;
- }
-
- /** Beginning in 1.5, we have an unsynchronized version of
- * StringBuffer called StringBuilder that can be used by the
- * compiler for string concatenation.
- */
- public boolean useStringBuilder() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** Beginning in 1.5, we have flag bits we can use instead of
- * marker attributes.
- */
- public boolean useSyntheticFlag() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean useEnumFlag() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean useAnnotationFlag() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean useVarargsFlag() {
- return compareTo(JDK1_5) >= 0;
- }
- public boolean useBridgeFlag() {
- return compareTo(JDK1_5) >= 0;
- }
-
/** Return the character to be used in constructing synthetic
* identifiers, where not specified by the JLS.
*/
@@ -243,12 +115,6 @@
return '$';
}
- /** Does the VM have direct support for class literals?
- */
- public boolean hasClassLiterals() {
- return compareTo(JDK1_5) >= 0;
- }
-
/** Does the VM support an invokedynamic instruction?
*/
public boolean hasInvokedynamic() {
@@ -263,39 +129,4 @@
return hasInvokedynamic();
}
- /** Although we may not have support for class literals, should we
- * avoid initializing the class that the literal refers to?
- * See 4468823
- */
- public boolean classLiteralsNoInit() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** Although we may not have support for class literals, when we
- * throw a NoClassDefFoundError, should we initialize its cause?
- */
- public boolean hasInitCause() {
- return compareTo(JDK1_4) >= 0;
- }
-
- /** For bootstrapping, we use J2SE1.4's wrapper class constructors
- * to implement boxing.
- */
- public boolean boxWithConstructors() {
- return compareTo(JDK1_5) < 0;
- }
-
- /** For bootstrapping, we use J2SE1.4's java.util.Collection
- * instead of java.lang.Iterable.
- */
- public boolean hasIterable() {
- return compareTo(JDK1_5) >= 0;
- }
-
- /** In J2SE1.5.0, we introduced the "EnclosingMethod" attribute
- * for improved reflection support.
- */
- public boolean hasEnclosingMethodAttribute() {
- return compareTo(JDK1_5) >= 0;
- }
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Jul 10 13:57:27 2014 -0700
@@ -441,20 +441,36 @@
// Unless lint checking on options is disabled, check for
// obsolete source and target options.
boolean obsoleteOptionFound = false;
- if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
- if (source.compareTo(Source.JDK1_5) <= 0) {
- log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name);
- obsoleteOptionFound = true;
- }
+
+ boolean lintOptions =
+ options.isUnset(XLINT_CUSTOM, "-"+LintCategory.OPTIONS.option);
- if (target.compareTo(Target.JDK1_5) <= 0) {
- log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name);
- obsoleteOptionFound = true;
- }
+ switch (source.compareTo(Source.MIN)) {
+ case -1:
+ log.error("option.removed.source", source.name, Source.MIN.name);
+ break;
+ case 0:
+ if (lintOptions) {
+ log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name);
+ obsoleteOptionFound = true;
+ }
+ break;
+ }
+ // check target version request
+ switch (target.compareTo(Target.MIN)) {
+ case -1:
+ log.error("option.removed.target", target.name, Target.MIN.name);
+ break;
+ case 0:
+ if (lintOptions) {
+ log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name);
+ obsoleteOptionFound = true;
+ }
+ break;
+ }
if (obsoleteOptionFound)
log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
- }
}
/* Switches:
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Thu Jul 10 13:57:27 2014 -0700
@@ -295,11 +295,7 @@
Target target = (targetString != null)
? Target.lookup(targetString)
: Target.DEFAULT;
- // We don't check source/target consistency for CLDC, as J2ME
- // profiles are not aligned with J2SE targets; moreover, a
- // single CLDC target may have many profiles. In addition,
- // this is needed for the continued functioning of the JSR14
- // prototype.
+
if (Character.isDigit(target.name.charAt(0))) {
if (target.compareTo(source.requiredTarget()) < 0) {
if (targetString != null) {
@@ -317,11 +313,6 @@
target = source.requiredTarget();
options.put("-target", target.name);
}
- } else {
- if (targetString == null && !source.allowGenerics()) {
- target = Target.JDK1_4;
- options.put("-target", target.name);
- }
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,10 +46,6 @@
private static final boolean scannerDebug = false;
- /** Allow hex floating-point literals.
- */
- private boolean allowHexFloats;
-
/** Allow binary literals.
*/
private boolean allowBinaryLiterals;
@@ -126,7 +122,6 @@
this.source = fac.source;
this.reader = reader;
this.allowBinaryLiterals = source.allowBinaryLiterals();
- this.allowHexFloats = source.allowHexFloats();
this.allowUnderscoresInLiterals = source.allowUnderscoresInLiterals();
}
@@ -220,11 +215,7 @@
skipIllegalUnderscores();
if ('0' <= reader.ch && reader.ch <= '9') {
scanDigits(pos, 10);
- if (!allowHexFloats) {
- lexError(pos, "unsupported.fp.lit", source.name);
- allowHexFloats = true;
- }
- else if (!hexFloatsWork)
+ if (!hexFloatsWork)
lexError(pos, "unsupported.cross.fp.lit");
} else
lexError(pos, "malformed.fp.lit");
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Jul 10 13:57:27 2014 -0700
@@ -144,13 +144,6 @@
this.log = fac.log;
this.names = fac.names;
this.source = fac.source;
- this.allowGenerics = source.allowGenerics();
- this.allowVarargs = source.allowVarargs();
- this.allowAsserts = source.allowAsserts();
- this.allowEnums = source.allowEnums();
- this.allowForeach = source.allowForeach();
- this.allowStaticImport = source.allowStaticImport();
- this.allowAnnotations = source.allowAnnotations();
this.allowTWR = source.allowTryWithResources();
this.allowDiamond = source.allowDiamond();
this.allowMulticatch = source.allowMulticatch();
@@ -179,10 +172,6 @@
return keepDocComments ? new LazyDocCommentTable(fac) : null;
}
- /** Switch: Should generics be recognized?
- */
- boolean allowGenerics;
-
/** Switch: Should diamond operator be recognized?
*/
boolean allowDiamond;
@@ -191,30 +180,6 @@
*/
boolean allowMulticatch;
- /** Switch: Should varargs be recognized?
- */
- boolean allowVarargs;
-
- /** Switch: should we recognize assert statements, or just give a warning?
- */
- boolean allowAsserts;
-
- /** Switch: should we recognize enums, or just give a warning?
- */
- boolean allowEnums;
-
- /** Switch: should we recognize foreach?
- */
- boolean allowForeach;
-
- /** Switch: should we recognize foreach?
- */
- boolean allowStaticImport;
-
- /** Switch: should we recognize annotations?
- */
- boolean allowAnnotations;
-
/** Switch: should we recognize try-with-resources?
*/
boolean allowTWR;
@@ -419,8 +384,8 @@
return;
break;
case ASSERT:
- if (stopAtStatement && allowAsserts)
- return ;
+ if (stopAtStatement)
+ return;
break;
}
nextToken();
@@ -604,27 +569,13 @@
nextToken();
return name;
} else if (token.kind == ASSERT) {
- if (allowAsserts) {
- error(token.pos, "assert.as.identifier");
- nextToken();
- return names.error;
- } else {
- warning(token.pos, "assert.as.identifier");
- Name name = token.name();
- nextToken();
- return name;
- }
+ error(token.pos, "assert.as.identifier");
+ nextToken();
+ return names.error;
} else if (token.kind == ENUM) {
- if (allowEnums) {
- error(token.pos, "enum.as.identifier");
- nextToken();
- return names.error;
- } else {
- warning(token.pos, "enum.as.identifier");
- Name name = token.name();
- nextToken();
- return name;
- }
+ error(token.pos, "enum.as.identifier");
+ nextToken();
+ return names.error;
} else if (token.kind == THIS) {
if (allowThisIdent) {
// Make sure we're using a supported source version.
@@ -1340,7 +1291,6 @@
}
accept(GT);
t = toP(F.at(pos1).TypeApply(t, args.toList()));
- checkGenerics();
while (token.kind == DOT) {
nextToken();
mode = TYPE;
@@ -1815,7 +1765,6 @@
(mode & TYPE) != 0 &&
(mode & NOPARAMS) == 0) {
mode = TYPE;
- checkGenerics();
return typeArguments(t, false);
} else {
return t;
@@ -1827,7 +1776,6 @@
List<JCExpression> typeArgumentsOpt(int useMode) {
if (token.kind == LT) {
- checkGenerics();
if ((mode & useMode) == 0 ||
(mode & NOPARAMS) != 0) {
illegal();
@@ -2060,7 +2008,6 @@
boolean diamondFound = false;
int lastTypeargsPos = -1;
if (token.kind == LT) {
- checkGenerics();
lastTypeargsPos = token.pos;
t = typeArguments(t, true);
diamondFound = (mode & DIAMOND) != 0;
@@ -2081,7 +2028,6 @@
if (token.kind == LT) {
lastTypeargsPos = token.pos;
- checkGenerics();
t = typeArguments(t, true);
diamondFound = (mode & DIAMOND) != 0;
}
@@ -2153,7 +2099,6 @@
if (token.kind == LT) {
int oldmode = mode;
- checkGenerics();
t = typeArguments(t, true);
mode = oldmode;
}
@@ -2357,7 +2302,6 @@
}
}
- @SuppressWarnings("fallthrough")
List<JCStatement> blockStatement() {
//todo: skip to anchor on error(?)
int pos = token.pos;
@@ -2374,7 +2318,7 @@
JCModifiers mods = modifiersOpt();
if (token.kind == INTERFACE ||
token.kind == CLASS ||
- allowEnums && token.kind == ENUM) {
+ token.kind == ENUM) {
return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
} else {
JCExpression t = parseType();
@@ -2396,15 +2340,11 @@
Comment dc = token.comment(CommentStyle.JAVADOC);
return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
case ENUM:
+ error(token.pos, "local.enum");
+ dc = token.comment(CommentStyle.JAVADOC);
+ return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
case ASSERT:
- if (allowEnums && token.kind == ENUM) {
- error(token.pos, "local.enum");
- dc = token.comment(CommentStyle.JAVADOC);
- return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
- } else if (allowAsserts && token.kind == ASSERT) {
- return List.of(parseStatement());
- }
- /* fall through to default */
+ return List.of(parseStatement());
default:
Token prevToken = token;
JCExpression t = term(EXPR | TYPE);
@@ -2452,7 +2392,6 @@
* | ExpressionStatement
* | Ident ":" Statement
*/
- @SuppressWarnings("fallthrough")
public JCStatement parseStatement() {
int pos = token.pos;
switch (token.kind) {
@@ -2477,7 +2416,6 @@
inits.head.hasTag(VARDEF) &&
((JCVariableDecl) inits.head).init == null &&
token.kind == COLON) {
- checkForeach();
JCVariableDecl var = (JCVariableDecl)inits.head;
accept(COLON);
JCExpression expr = parseExpression();
@@ -2593,19 +2531,16 @@
case CATCH:
return doRecover(token.pos, BasicErrorRecoveryAction.CATCH_CLAUSE, "catch.without.try");
case ASSERT: {
- if (allowAsserts && token.kind == ASSERT) {
+ nextToken();
+ JCExpression assertion = parseExpression();
+ JCExpression message = null;
+ if (token.kind == COLON) {
nextToken();
- JCExpression assertion = parseExpression();
- JCExpression message = null;
- if (token.kind == COLON) {
- nextToken();
- message = parseExpression();
- }
- accept(SEMI);
- JCAssert t = toP(F.at(pos).Assert(assertion, message));
- return t;
+ message = parseExpression();
}
- /* else fall through to default case */
+ accept(SEMI);
+ JCAssert t = toP(F.at(pos).Assert(assertion, message));
+ return t;
}
case ENUM:
default:
@@ -2831,7 +2766,6 @@
lastPos = token.pos;
nextToken();
if (flag == Flags.ANNOTATION) {
- checkAnnotations();
if (token.kind != INTERFACE) {
JCAnnotation ann = annotation(lastPos, Tag.ANNOTATION);
// if first modifier is an annotation, set pos to annotation's.
@@ -2867,7 +2801,6 @@
*/
JCAnnotation annotation(int pos, Tag kind) {
// accept(AT); // AT consumed by caller
- checkAnnotations();
if (kind == Tag.TYPE_ANNOTATION) {
checkTypeAnnotations();
}
@@ -3166,7 +3099,6 @@
nextToken();
boolean importStatic = false;
if (token.kind == STATIC) {
- checkStaticImports();
importStatic = true;
nextToken();
}
@@ -3209,27 +3141,9 @@
return classDeclaration(mods, dc);
} else if (token.kind == INTERFACE) {
return interfaceDeclaration(mods, dc);
- } else if (allowEnums) {
- if (token.kind == ENUM) {
- return enumDeclaration(mods, dc);
- } else {
- int pos = token.pos;
- List<JCTree> errs;
- if (LAX_IDENTIFIER.accepts(token.kind)) {
- errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
- setErrorEndPos(token.pos);
- } else {
- errs = List.<JCTree>of(mods);
- }
- return toP(F.Exec(syntaxError(pos, errs, "expected3",
- CLASS, INTERFACE, ENUM)));
- }
+ } else if (token.kind == ENUM) {
+ return enumDeclaration(mods, dc);
} else {
- if (token.kind == ENUM) {
- error(token.pos, "enums.not.supported.in.source", source.name);
- allowEnums = true;
- return enumDeclaration(mods, dc);
- }
int pos = token.pos;
List<JCTree> errs;
if (LAX_IDENTIFIER.accepts(token.kind)) {
@@ -3238,8 +3152,8 @@
} else {
errs = List.<JCTree>of(mods);
}
- return toP(F.Exec(syntaxError(pos, errs, "expected2",
- CLASS, INTERFACE)));
+ return toP(F.Exec(syntaxError(pos, errs, "expected3",
+ CLASS, INTERFACE, ENUM)));
}
}
@@ -3315,7 +3229,7 @@
mods.flags |= Flags.ENUM;
JCClassDecl result = toP(F.at(pos).
ClassDef(mods, name, List.<JCTypeParameter>nil(),
- null, implementing, defs));
+ null, implementing, defs));
attach(result, dc);
return result;
}
@@ -3465,7 +3379,7 @@
JCModifiers mods = modifiersOpt();
if (token.kind == CLASS ||
token.kind == INTERFACE ||
- allowEnums && token.kind == ENUM) {
+ token.kind == ENUM) {
return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
} else if (token.kind == LBRACE &&
(mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
@@ -3634,7 +3548,6 @@
*/
List<JCTypeParameter> typeParametersOpt() {
if (token.kind == LT) {
- checkGenerics();
ListBuffer<JCTypeParameter> typarams = new ListBuffer<>();
nextToken();
typarams.append(typeParameter());
@@ -3822,7 +3735,6 @@
if (token.kind == ELLIPSIS) {
List<JCAnnotation> varargsAnnos = typeAnnotationsPushedBack;
typeAnnotationsPushedBack = List.nil();
- checkVarargs();
mods.flags |= Flags.VARARGS;
// insert var arg type annotations
type = insertAnnotationsToMostInner(type, varargsAnnos, true);
@@ -4009,36 +3921,6 @@
}
}
- void checkGenerics() {
- if (!allowGenerics) {
- error(token.pos, "generics.not.supported.in.source", source.name);
- allowGenerics = true;
- }
- }
- void checkVarargs() {
- if (!allowVarargs) {
- error(token.pos, "varargs.not.supported.in.source", source.name);
- allowVarargs = true;
- }
- }
- void checkForeach() {
- if (!allowForeach) {
- error(token.pos, "foreach.not.supported.in.source", source.name);
- allowForeach = true;
- }
- }
- void checkStaticImports() {
- if (!allowStaticImport) {
- error(token.pos, "static.import.not.supported.in.source", source.name);
- allowStaticImport = true;
- }
- }
- void checkAnnotations() {
- if (!allowAnnotations) {
- error(token.pos, "annotations.not.supported.in.source", source.name);
- allowAnnotations = true;
- }
- }
void checkDiamond() {
if (!allowDiamond) {
error(token.pos, "diamond.not.supported.in.source", source.name);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Jul 10 13:57:27 2014 -0700
@@ -720,6 +720,7 @@
second operand: {0}\n\
third operand : {1}
+
# 0: message segment
compiler.misc.incompatible.type.in.conditional=\
bad type in conditional expression\n\
@@ -1467,6 +1468,14 @@
compiler.warn.option.obsolete.target=\
target value {0} is obsolete and will be removed in a future release
+# 0: string, 1: string
+compiler.err.option.removed.source=\
+ Source option {0} is no longer supported. Use {1} or later.
+
+# 0: string, 1: string
+compiler.err.option.removed.target=\
+ Target option {0} is no longer supported. Use {1} or later.
+
compiler.warn.option.obsolete.suppression=\
To suppress warnings about obsolete options, use -Xlint:-options.
@@ -2235,11 +2244,6 @@
# Diagnostics for language feature changes
########################################
# 0: string
-compiler.err.unsupported.fp.lit=\
- hexadecimal floating point literals are not supported in -source {0}\n\
- (use -source 5 or higher to enable hexadecimal floating point literals)
-
-# 0: string
compiler.err.unsupported.binary.lit=\
binary literals are not supported in -source {0}\n\
(use -source 7 or higher to enable binary literals)
@@ -2254,14 +2258,6 @@
try-with-resources is not supported in -source {0}\n\
(use -source 7 or higher to enable try-with-resources)
-compiler.warn.enum.as.identifier=\
- as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
- (use -source 5 or higher to use ''enum'' as a keyword)
-
-compiler.warn.assert.as.identifier=\
- as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
- (use -source 1.4 or higher to use ''assert'' as a keyword)
-
compiler.warn.underscore.as.identifier=\
''_'' used as an identifier\n\
(use of ''_'' as an identifier might not be supported in releases after Java SE 8)
@@ -2271,12 +2267,10 @@
(use of ''_'' as an identifier is forbidden for lambda parameters)
compiler.err.enum.as.identifier=\
- as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
- (use -source 1.4 or lower to use ''enum'' as an identifier)
+ as of release 5, ''enum'' is a keyword, and may not be used as an identifier
compiler.err.assert.as.identifier=\
- as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
- (use -source 1.3 or lower to use ''assert'' as an identifier)
+ as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier
# TODO 308: make a better error message
compiler.err.this.as.identifier=\
@@ -2324,21 +2318,6 @@
no annotations are allowed in the type of a class literal
# 0: string
-compiler.err.generics.not.supported.in.source=\
- generics are not supported in -source {0}\n\
- (use -source 5 or higher to enable generics)
-
-# 0: string
-compiler.err.varargs.not.supported.in.source=\
- variable-arity methods are not supported in -source {0}\n\
- (use -source 5 or higher to enable variable-arity methods)
-
-# 0: string
-compiler.err.annotations.not.supported.in.source=\
- annotations are not supported in -source {0}\n\
- (use -source 5 or higher to enable annotations)
-
-# 0: string
compiler.err.type.annotations.not.supported.in.source=\
type annotations are not supported in -source {0}\n\
(use -source 8 or higher to enable type annotations)
@@ -2354,21 +2333,6 @@
(use -source 8 or higher to enable repeated annotations)
# 0: string
-compiler.err.foreach.not.supported.in.source=\
- enhanced for loops are not supported in -source {0}\n\
- (use -source 5 or higher to enable for-each loops)
-
-# 0: string
-compiler.err.static.import.not.supported.in.source=\
- static import declarations are not supported in -source {0}\n\
- (use -source 5 or higher to enable static import declarations)
-
-# 0: string
-compiler.err.enums.not.supported.in.source=\
- enums are not supported in -source {0}\n\
- (use -source 5 or higher to enable enums)
-
-# 0: string
compiler.err.diamond.not.supported.in.source=\
diamond operator is not supported in -source {0}\n\
(use -source 7 or higher to enable diamond operator)
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Thu Jul 10 13:57:27 2014 -0700
@@ -270,16 +270,9 @@
} else if (result.isMalformed() || result.isUnmappable()) {
// bad character in input
- // report coding error (warn only pre 1.5)
- if (!getSource().allowEncodingErrors()) {
- log.error(new SimpleDiagnosticPosition(dest.limit()),
- "illegal.char.for.encoding",
- charset == null ? encodingName : charset.name());
- } else {
- log.warning(new SimpleDiagnosticPosition(dest.limit()),
- "illegal.char.for.encoding",
- charset == null ? encodingName : charset.name());
- }
+ log.error(new SimpleDiagnosticPosition(dest.limit()),
+ "illegal.char.for.encoding",
+ charset == null ? encodingName : charset.name());
// skip past the coding error
inbuf.position(inbuf.position() + result.length());
--- a/langtools/test/tools/javac/defaultMethods/crossCompile/CrossCompile.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/defaultMethods/crossCompile/CrossCompile.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
* @test
* @bug 7192246
* @summary check that clinit in interface doesn't cause spurious default method diagnostics
- * @compile -source 1.4 -target 1.4 Clinit.java
+ * @compile Clinit.java
* @compile CrossCompile.java
*/
class CrossCompile {
--- a/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java Thu Jul 10 13:57:27 2014 -0700
@@ -101,10 +101,6 @@
public static void main(String[] args) throws Exception {
String[] sources = new String[] {
- "1.2",
- "1.3",
- "1.4",
- "1.5",
"1.6",
"1.7",
};
--- a/langtools/test/tools/javac/diags/examples/AnnotationsNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.annotations.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-@Deprecated
-class AnnotationsNotSupported { }
--- a/langtools/test/tools/javac/diags/examples/AssertAsIdentifier.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.assert.as.identifier
-// options: -source 1.3 -Xlint:-options
-
-class AssertAsIdentifier {
- int assert;
-}
--- a/langtools/test/tools/javac/diags/examples/EnumAsIdentifier.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.enum.as.identifier
-// options: -source 1.3 -Xlint:-options
-
-class EnumAsIdentifier {
- int enum;
-}
--- a/langtools/test/tools/javac/diags/examples/EnumsNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.enums.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-enum EnumsNotSupported { A, B, C }
--- a/langtools/test/tools/javac/diags/examples/Expected2.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/Expected2.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,12 @@
*/
// key: compiler.err.expected2
-// options: -source 1.4 -Xlint:-options
+// options: -Xlint:-options
+
+class Expected2 {
-int Expected2;
+ void m(){
+ new x1;
+
+ }
+}
--- a/langtools/test/tools/javac/diags/examples/ForeachNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.foreach.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class ForeachNotSupported {
- void m(String[] args) {
- for (String a: args) {
- System.out.println(a);
- }
- }
-}
--- a/langtools/test/tools/javac/diags/examples/GenericsNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.generics.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class GenericsNotSupported<T> { }
--- a/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,10 +22,13 @@
*/
// key: compiler.err.neither.conditional.subtype
-// options: -source 1.4 -Xlint:-options
-class X {
- Object m(boolean b) {
- return (b ? 3 : b);
+class NeitherConditionalSubtype {
+ public int test(Object o) {
+ // Should fail to compile since Object.wait() has a void return type.
+ System.out.println(o instanceof String ? o.hashCode() : o.wait());
+ return 0;
}
}
+
+
--- a/langtools/test/tools/javac/diags/examples/ObsoleteSourceAndTarget.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/ObsoleteSourceAndTarget.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
// key: compiler.warn.option.obsolete.target
// key: compiler.warn.option.obsolete.suppression
// key: compiler.warn.source.no.bootclasspath
-// options: -source 1.5 -target 1.5
+// options: -source 1.6 -target 1.6
class ObsoleteSourceAndTarget {
public static void foo() {;}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OptionRemovedSource.java Thu Jul 10 13:57:27 2014 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.option.removed.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 1.5
+
+class RemovedSourceAndTarget {
+ public static void foo() {;}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OptionRemovedTarget.java Thu Jul 10 13:57:27 2014 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.option.removed.source
+// key: compiler.err.option.removed.target
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 1.5 -target 1.5
+
+class RemovedSourceAndTarget {
+ public static void foo() {;}
+}
--- a/langtools/test/tools/javac/diags/examples/SourceNoBootclasspath.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/SourceNoBootclasspath.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,6 @@
*/
// key: compiler.warn.source.no.bootclasspath
-// options: -source 6
+// options: -source 7
class SourceNoBootclasspath { }
--- a/langtools/test/tools/javac/diags/examples/StaticImportNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.static.import.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-import static java.util.regex.Pattern.*;
-
-class StaticImportNotSupported { }
--- a/langtools/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
// key: compiler.err.type.annotations.not.supported.in.source
// key: compiler.warn.source.no.bootclasspath
-// options: -source 6
+// options: -source 7
@interface Anno { }
--- a/langtools/test/tools/javac/diags/examples/UnsupportedFpLit.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.unsupported.fp.lit
-// options: -source 1.4 -Xlint:-options
-
-class UnsupportedFpLit {
- float f = 0xCafe.BabeP1;
-}
--- a/langtools/test/tools/javac/diags/examples/VarargsNotSupported.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.varargs.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class VarargsNotSupported {
- void m(String... args) { }
-}
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/Base.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package base;
-
-public class Base extends PackagePrivate { }
-
-class PackagePrivate {
- protected int refTobaseBase() {
- return 0;
- }
- protected int refTotestOtherPackageTest() {
- return 0;
- }
- protected int refTotestTarget11() {
- return 0;
- }
- protected int refTotestCurPackagePrivateExt11() {
- return 0;
- }
- protected int refTobaseBase;
- protected int refTotestOtherPackageTest;
- protected int refTotestTarget11;
- protected int refTotestCurPackagePrivateExt11;
-}
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8027789
- * @summary check that the direct superclass is used as the site when calling
- * a superclass' method
- * @compile Base.java NonDirectSuper.java
- * @compile -source 1.2 -target 1.1 Target11.java
- * @run main test.NonDirectSuper
- */
-
-package test;
-
-import java.io.File;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool.CPRefInfo;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.Opcode;
-
-public class NonDirectSuper {
- public static void main(String... args) {
- new NonDirectSuper().run();
- }
-
- void run() {
- String workDir = System.getProperty("test.classes");
- File testPackage = new File(workDir, "test");
-
- for (File clazz : testPackage.listFiles()) {
- if ("NonDirectSuper.class".equals(clazz.getName())) continue;
- verifyInvokeSpecialRefToObject(clazz);
- }
- }
-
- void verifyInvokeSpecialRefToObject(File clazz) {
- try {
- final ClassFile cf = ClassFile.read(clazz);
- for (Method m : cf.methods) {
- Code_attribute codeAttr = (Code_attribute)m.attributes.get(Attribute.Code);
- for (Instruction instr : codeAttr.getInstructions()) {
- if (instr.getOpcode() == Opcode.INVOKESPECIAL ||
- instr.getOpcode() == Opcode.INVOKEVIRTUAL) {
- int pc_index = instr.getShort(1);
- CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
- String className = ref.getClassName();
- String methodName = ref.getNameAndTypeInfo().getName();
- if (methodName.equals("toString")) {
- if (!className.equals("java/lang/Object"))
- throw new IllegalStateException("Must directly refer to j.l.Object");
- } else if (methodName.startsWith("refTo")) {
- String expectedClass = methodName.substring("refTo".length());
- if (!className.replace("/", "").equals(expectedClass)) {
- throw new IllegalStateException("Unexpected reference to: " +
- className + ", should be " + expectedClass);
- }
- }
- }
- if (instr.getOpcode() == Opcode.GETFIELD ||
- instr.getOpcode() == Opcode.PUTFIELD) {
- int pc_index = instr.getShort(1);
- CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
- String className = ref.getClassName();
- String fieldName = ref.getNameAndTypeInfo().getName();
- if (fieldName.startsWith("refTo")) {
- String expectedClass = fieldName.substring("refTo".length());
- if (!className.replace("/", "").equals(expectedClass)) {
- throw new IllegalStateException("Unexpected reference to: " +
- className + ", should be " + expectedClass);
- }
- }
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new Error("error reading " + clazz +": " + e);
- }
- }
-}
-
-class OtherPackageTest extends base.Base {
- void run() {
- new Runnable() {
- public void run() {
- OtherPackageTest.super.refTobaseBase();
- OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
- OtherPackageTest.super.toString();
- refTotestOtherPackageTest();
- refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
- OtherPackageTest.this.refTotestOtherPackageTest();
- OtherPackageTest.this.refTotestOtherPackageTest =
- OtherPackageTest.this.refTotestOtherPackageTest + 1;
- }
- }.run();
- super.refTobaseBase();
- super.refTobaseBase = super.refTobaseBase + 1;
- super.toString();
- OtherPackageTest.super.refTobaseBase();
- OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
- OtherPackageTest.super.toString();
- refTotestOtherPackageTest();
- refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
- }
-
- static class InnerBase {
- private void refTotestOtherPackageTest$InnerBase() { }
- }
- static class InnerTest extends InnerBase {
- void run() {
- new Runnable() {
- public void run() {
- InnerTest.super.refTotestOtherPackageTest$InnerBase();
- }
- }.run();
- super.refTotestOtherPackageTest$InnerBase();
- InnerTest.super.refTotestOtherPackageTest$InnerBase();
- }
- }
-}
-
-class CurPackagePrivateBase {
- void refTotestCurPackagePrivateExt() { }
- void refTotestCurPackagePrivateTest() { }
- int refTotestCurPackagePrivateExt;
- int refTotestCurPackagePrivateTest;
-}
-
-class CurPackagePrivateExt extends CurPackagePrivateBase {
-}
-
-class CurPackagePrivateTest extends CurPackagePrivateExt {
- void run() {
- new Runnable() {
- public void run() {
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
- CurPackagePrivateTest.this.refTotestCurPackagePrivateTest();
- CurPackagePrivateTest.this.refTotestCurPackagePrivateTest =
- CurPackagePrivateTest.this.refTotestCurPackagePrivateTest + 1;
- refTotestCurPackagePrivateTest();
- refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
- }
- }.run();
- super.refTotestCurPackagePrivateExt();
- super.refTotestCurPackagePrivateExt = super.refTotestCurPackagePrivateExt + 1;
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
- CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
- refTotestCurPackagePrivateTest();
- refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
- }
-}
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/Target11.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package test;
-
-class Target11 extends CurPackagePrivateExt11 {
- void run() {
- new Runnable() {
- public void run() {
- Target11.super.refTotestCurPackagePrivateBase11();
- Target11.super.refTotestCurPackagePrivateBase11 =
- Target11.super.refTotestCurPackagePrivateBase11 + 1;
- Target11.super.refTotestCurPackagePrivateExt11();
- Target11.super.refTotestCurPackagePrivateExt11 =
- Target11.super.refTotestCurPackagePrivateExt11 + 1;
- Target11.super.toString();
- refTotestCurPackagePrivateBase11();
- refTotestCurPackagePrivateBase11 =
- refTotestCurPackagePrivateBase11 + 1;
- refTotestTarget11();
- refTotestTarget11 = refTotestTarget11 + 1;
- Target11.this.refTotestCurPackagePrivateBase11();
- Target11.this.refTotestCurPackagePrivateBase11 =
- Target11.this.refTotestCurPackagePrivateBase11 + 1;
- Target11.this.refTotestTarget11();
- Target11.this.refTotestTarget11 =
- Target11.this.refTotestTarget11 + 1;
- }
- }.run();
- super.refTotestCurPackagePrivateBase11();
- super.refTotestCurPackagePrivateBase11 =
- super.refTotestCurPackagePrivateBase11 + 1;
- super.refTotestCurPackagePrivateExt11();
- super.refTotestCurPackagePrivateExt11 =
- super.refTotestCurPackagePrivateExt11 + 1;
- super.toString();
-
- Target11.super.refTotestCurPackagePrivateBase11();
- Target11.super.refTotestCurPackagePrivateBase11 =
- Target11.super.refTotestCurPackagePrivateBase11 + 1;
- Target11.super.refTotestCurPackagePrivateExt11();
- Target11.super.refTotestCurPackagePrivateExt11 =
- Target11.super.refTotestCurPackagePrivateExt11 + 1;
-
- refTotestCurPackagePrivateBase11();
- refTotestCurPackagePrivateBase11 = refTotestCurPackagePrivateBase11 + 1;
- refTotestTarget11 = refTotestTarget11 + 1;
- }
-}
-
-class CurPackagePrivateBase11 extends base.Base {
- protected void refTotestCurPackagePrivateBase11() {}
- protected int refTotestCurPackagePrivateBase11;
-}
-
-class CurPackagePrivateExt11 extends CurPackagePrivateBase11 { }
--- a/langtools/test/tools/javac/miranda/6964669/T6964669.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6964669
- * @summary javac reports error on miranda methods
- * @compile -source 1.2 -target 1.1 pkg/A.java pkg/B.java pkg/C.java
- */
--- a/langtools/test/tools/javac/miranda/6964669/pkg/A.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public abstract class A implements C {}
--- a/langtools/test/tools/javac/miranda/6964669/pkg/B.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public class B extends A {
- public void a() {}
-}
--- a/langtools/test/tools/javac/miranda/6964669/pkg/C.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package pkg;
-
-public interface C {
- public void a();
-}
--- a/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts1.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
- * @author gafter
- *
- * @compile CompatibleAbstracts1.java
- * @compile CompatibleAbstracts2.java
- * @compile -source 1.4 CompatibleAbstracts2.java
- * @compile CompatibleAbstracts3.java
- * @compile/fail -source 1.4 CompatibleAbstracts3.java
- * @compile CompatibleAbstracts4.java
- * @compile/fail -source 1.4 CompatibleAbstracts4.java
- * @compile CompatibleAbstracts5.java
- * @compile/fail -source 1.4 CompatibleAbstracts5.java
- */
-
-interface A {
- A f();
-}
-
-interface B extends A {
- B f();
-}
-
-interface C {
- B f();
-}
-
-interface D {
- D f();
-}
--- a/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts2.java Wed Jul 09 10:49:32 2014 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-abstract class CompatibleAbstracts2
- implements A, B // OK, as interfaces A and B are already related
-{
- void f(A a, B b) {
- if (a == b) ;
- B b2 = (B) a;
- A a2 = (A) b;
- }
-}
--- a/langtools/test/tools/javac/mixedTarget/ExtendCovariant1.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/mixedTarget/ExtendCovariant1.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,10 @@
/*
* @test
* @bug 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
+ * @summary Ensure covariant return type allowed
* @author gafter
*
- * @compile -source 1.4 ExtendCovariant1.java
+ * @compile ExtendCovariant1.java
*/
/**
@@ -37,8 +37,7 @@
*
* java.lang.Appendable java.lang.Appendable.append(char)
*
- * Yet javac should allow extending PrintStream, as long as the user
- * doesn't directly override a covariant method in -source 1.4.
+ * With JDK 1.5, a covariant return is allowed so check that is the case.
**/
public class ExtendCovariant1 extends java.io.PrintStream {
ExtendCovariant1() throws java.io.IOException {
--- a/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,10 @@
/*
* @test
* @bug 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
+ * @summary Ensure Covariant Return Type allowed in minimum supported version
* @author gafter
*
- * @compile/fail -source 1.4 ExtendCovariant2.java
+ * @compile -source 1.6 ExtendCovariant2.java
* @compile ExtendCovariant2.java
*/
@@ -38,8 +38,8 @@
*
* java.lang.Appendable java.lang.Appendable.append(char)
*
- * Yet javac should allow extending PrintStream, as long as the user
- * doesn't directly override a covariant method in -source 1.4.
+ * With JDK 1.5, a Covariant Return is allowed so check that is the case.
+ *
**/
public class ExtendCovariant2 extends java.io.PrintStream {
ExtendCovariant2() throws java.io.IOException {
--- a/langtools/test/tools/javac/options/T6900037.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/options/T6900037.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,9 @@
* @bug 6900037
* @summary javac should warn if earlier -source is used and bootclasspath not set
* @compile T6900037.java
- * @compile -source 1.6 T6900037.java
- * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.6 T6900037.java
- * @compile -Werror -source 1.6 -Xlint:-options T6900037.java
+ * @compile -source 1.8 T6900037.java
+ * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.8 T6900037.java
+ * @compile -Werror -source 1.8 -Xlint:-options T6900037.java
*/
class T6900037 { }
--- a/langtools/test/tools/javac/options/T6900037.out Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/options/T6900037.out Thu Jul 10 13:57:27 2014 -0700
@@ -1,4 +1,4 @@
-- compiler.warn.source.no.bootclasspath: 1.6
+- compiler.warn.source.no.bootclasspath: 1.8
- compiler.err.warnings.and.werror
1 error
1 warning
--- a/langtools/test/tools/javac/options/T7022337.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/options/T7022337.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
"-XDrawDiagnostics",
"-d", ".",
"-processor", myName,
- "-source", "6", // explicit use of older source value without bootclasspath
+ "-source", "8", // explicit use of older source value without bootclasspath
file.getPath());
int count = 0;
--- a/langtools/test/tools/javac/processing/messager/MessagerDiags.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/processing/messager/MessagerDiags.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
import static javax.tools.Diagnostic.Kind.*;
import static javax.tools.JavaFileObject.Kind.*;
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedAnnotationTypes("*")
public class MessagerDiags extends AbstractProcessor {
static final String CNAME = "Test";
@@ -64,8 +64,8 @@
static final String WRN_WITH_SOURCE = "warning with source";
static final String NONE = "<none>";
static final String[] EXPECTED = { NONE + ":-1--1:" + WRN_NO_SOURCE,
- TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE,
- NONE + ":-1--1:" + WRN_NO_SOURCE
+ TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE,
+ NONE + ":-1--1:" + WRN_NO_SOURCE
};
@Override
@@ -88,7 +88,7 @@
DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<>();
List<String> options = new LinkedList<>();
options.addAll(Arrays.asList("-bootclasspath", bootPath,
- "-source", "1.6", "-classpath",
+ "-source", "1.8", "-classpath",
System.getProperty("java.class.path")));
options.addAll(Arrays.asList("-processor",
MessagerDiags.class.getName()));
--- a/langtools/test/tools/javac/versions/check.sh Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/versions/check.sh Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,13 @@
# @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961
# @summary Check interpretation of -target and -source options
# @build CheckClassFileVersion
-# @run shell check.sh
+# @run shell check.sh
TESTJAVA=${TESTJAVA:?}
TC=${TESTCLASSES-.}
-J="$TESTJAVA/bin/java"
-JC="$TESTJAVA/bin/javac"
+J="$TESTJAVA/bin/java"
+JC="$TESTJAVA/bin/javac"
CFV="${TESTVMOPTS} -cp $TC CheckClassFileVersion"
rm -f $TC/X.java $TC/X.java
@@ -58,27 +58,16 @@
check_target $1 1.${2} $3
}
-check 48.0 -source 1.4
-check 49.0 -source 1.4 -target 1.5
-check 49.0 -source 1.5 -target 1.5
-
-check_target 50.0 1.4 6
-check_target 50.0 1.5 6
check_source_target 50.0 6 6
-check_target 51.0 1.4 7
-check_target 51.0 1.5 7
check_source_target 51.0 6 7
check_source_target 51.0 7 7
-check_target 52.0 1.4 8
-check_target 52.0 1.5 8
check_source_target 52.0 6 8
check_source_target 52.0 7 8
check_source_target 52.0 8 8
-check_target 52.0 1.5 9
check_source_target 52.0 8 9
check_source_target 52.0 9 9
@@ -115,11 +104,7 @@
checksrc18() { checksrc15 $* ; }
checksrc19() { checksrc15 $* ; }
-checksrc14 -source 1.4
-checksrc14 -source 1.4 -target 1.5
-checksrc15 -source 1.5
-checksrc15 -source 1.5 -target 1.5
checksrc16 -source 1.6
checksrc16 -source 6
@@ -144,9 +129,6 @@
checksrc19 -target 1.9
checksrc19 -target 9
-fail -source 1.5 -target 1.4 $TC/X.java
-fail -source 1.6 -target 1.4 $TC/X.java
-fail -source 6 -target 1.4 $TC/X.java
fail -source 1.6 -target 1.5 $TC/X.java
fail -source 6 -target 1.5 $TC/X.java
fail -source 7 -target 1.6 $TC/X.java