Skip to content
Permalink
Browse files
8261721: [lworld] Javac messages still refer to inline types
  • Loading branch information
Srikanth Adayapalam committed Feb 15, 2021
1 parent 9e577c0 commit dad7d191970fcf6869b58ec725d5bb6226619ac5
Showing with 125 additions and 125 deletions.
  1. +1 −1 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
  2. +9 −9 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
  3. +5 −5 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
  4. +6 −6 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
  5. +1 −1 src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
  6. +31 −31 src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
  7. +6 −6 test/langtools/tools/javac/diags/examples.not-yet.txt
  8. +1 −1 ...ags/examples/{ValueInstanceFieldExpectedHere.java → PrimitiveClassInstanceFieldExpectedHere.java}
  9. +1 −1 ...gtools/tools/javac/diags/examples/{InlineMayNotOverride.java → PrimitiveClassMayNotOverride.java}
  10. +1 −1 .../langtools/tools/javac/diags/examples/{ValuesNotSupported.java → PrimitiveClassNotSupported.java}
  11. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/BinarySuperclassConstraints.out
  12. +5 −5 test/langtools/tools/javac/valhalla/lworld-values/CheckClone.out
  13. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/CheckCyclicMembership.out
  14. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/CheckExtends.out
  15. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/CheckFeatureGate1.out
  16. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/CheckFeatureGate2.out
  17. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/CheckFinal.out
  18. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/CheckFinalize.out
  19. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/CheckFlattenableCycles.out
  20. +17 −17 test/langtools/tools/javac/valhalla/lworld-values/CheckObjectMethodsUsage.out
  21. +16 −16 test/langtools/tools/javac/valhalla/lworld-values/CheckSync.out
  22. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest2.out
  23. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/SneakThroSuperCallTest.out
  24. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/SuperclassConstraints.out
  25. +1 −1 test/langtools/tools/javac/valhalla/lworld-values/TopInterfaceNegativeTest.out
  26. +2 −2 test/langtools/tools/javac/valhalla/lworld-values/ValueModifierTest.out
  27. +3 −3 test/langtools/tools/javac/valhalla/lworld-values/WithFieldOperatorTest.out
@@ -223,7 +223,7 @@ public Target requiredTarget() {
PATTERN_MATCHING_IN_INSTANCEOF(JDK16, Fragments.FeaturePatternMatchingInstanceof, DiagKind.NORMAL),
REIFIABLE_TYPES_INSTANCEOF(JDK16, Fragments.FeatureReifiableTypesInstanceof, DiagKind.PLURAL),
RECORDS(JDK16, Fragments.FeatureRecords, DiagKind.PLURAL),
INLINE_TYPES(JDK17, Fragments.FeatureInlineType, DiagKind.NORMAL),
PRIMITIVE_CLASSES(JDK17, Fragments.FeaturePrimitiveClasses, DiagKind.NORMAL),
SEALED_CLASSES(JDK17, Fragments.FeatureSealedClasses, DiagKind.PLURAL),
;

@@ -167,7 +167,7 @@ protected Attr(Context context) {
allowLambda = Feature.LAMBDA.allowedInSource(source);
allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source);
allowStaticInterfaceMethods = Feature.STATIC_INTERFACE_METHODS.allowedInSource(source);
allowInlineTypes = Feature.INLINE_TYPES.allowedInSource(source);
allowPrimitiveClasses = Feature.PRIMITIVE_CLASSES.allowedInSource(source);
allowReifiableTypesInInstanceof =
Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source) &&
(!preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF) || preview.isEnabled());
@@ -201,9 +201,9 @@ protected Attr(Context context) {
*/
boolean allowDefaultMethods;

/** Switch: allow inline types?
/** Switch: allow primitive classes ?
*/
boolean allowInlineTypes;
boolean allowPrimitiveClasses;

/** Switch: static interface methods enabled?
*/
@@ -1529,7 +1529,7 @@ public void visitWithField(JCWithField tree) {
final Symbol sym = TreeInfo.symbol(tree.field);
if (sym == null || sym.kind != VAR || sym.owner.kind != TYP ||
(sym.flags() & STATIC) != 0 || !types.isValue(sym.owner.type)) {
log.error(tree.field.pos(), Errors.ValueInstanceFieldExpectedHere);
log.error(tree.field.pos(), Errors.PrimitiveClassInstanceFieldExpectedHere);
} else {
Type ownType = sym.owner.type;
switch(tree.field.getTag()) {
@@ -2561,21 +2561,21 @@ public void visitApply(JCMethodInvocation tree) {
if (argSize == 0
|| (types.isConvertible(argtypes.head, syms.longType) &&
(argSize == 1 || (argSize == 2 && types.isConvertible(argtypes.tail.head, syms.intType))))) {
log.error(tree.pos(), Errors.ValueDoesNotSupport(name));
log.error(tree.pos(), Errors.PrimitiveClassDoesNotSupport(name));
}
break;
case "notify":
case "notifyAll":
case "clone":
case "finalize":
if (argSize == 0)
log.error(tree.pos(), Errors.ValueDoesNotSupport(name));
log.error(tree.pos(), Errors.PrimitiveClassDoesNotSupport(name));
break;
case "hashCode":
case "equals":
case "toString":
if (superCallOnValueReceiver)
log.error(tree.pos(), Errors.ValueDoesNotSupport(names.fromString("invocation of super." + name)));
log.error(tree.pos(), Errors.PrimitiveClassDoesNotSupport(names.fromString("invocation of super." + name)));
break;
}
}
@@ -4256,9 +4256,9 @@ public void visitSelect(JCFieldAccess tree) {
if (tree.name == names._this || tree.name == names._super ||
tree.name == names._class || tree.name == names._default)
{
if (tree.name == names._default && !allowInlineTypes) {
if (tree.name == names._default && !allowPrimitiveClasses) {
log.error(DiagnosticFlag.SOURCE_LEVEL, tree.pos(),
Feature.INLINE_TYPES.error(sourceName));
Feature.PRIMITIVE_CLASSES.error(sourceName));
}
skind = KindSelector.TYP;
} else {
@@ -744,7 +744,7 @@ void checkConstraintsOfInlineSuper(DiagnosticPosition pos, ClassSymbol c) {
if (st.tsym == syms.objectType.tsym)
return;
if (!st.tsym.isAbstract()) {
log.error(pos, Errors.ConcreteSupertypeForInlineClass(c, st));
log.error(pos, Errors.ConcreteSupertypeForPrimitiveClass(c, st));
}
if ((st.tsym.flags() & HASINITBLOCK) != 0) {
log.error(pos, Errors.SuperClassDeclaresInitBlock(c, st));
@@ -918,7 +918,7 @@ public Void visitType(Type t, DiagnosticPosition pos) {
public Void visitClassType(ClassType t, DiagnosticPosition pos) {
for (Type targ : t.allparams()) {
if (types.isValue(targ)) {
log.error(pos, Errors.GenericParameterizationWithValueType(t));
log.error(pos, Errors.GenericParameterizationWithPrimitiveClass(t));
}
visit(targ, pos);
}
@@ -1962,7 +1962,7 @@ void checkOverride(JCTree tree,
if (origin.isValue() && other.owner == syms.objectType.tsym && m.type.getParameterTypes().size() == 0) {
if (m.name == names.clone || m.name == names.finalize) {
log.error(TreeInfo.diagnosticPositionFor(m, tree),
Errors.InlineClassMayNotOverride(m.name));
Errors.PrimitiveClassMayNotOverride(m.name));
m.flags_field |= BAD_OVERRIDE;
return;
}
@@ -2429,7 +2429,7 @@ void checkNonCyclicMembership(JCClassDecl tree) {
// where
private void checkNonCyclicMembership(ClassSymbol c, DiagnosticPosition pos) {
if ((c.flags_field & LOCKED) != 0) {
log.error(pos, Errors.CyclicValueTypeMembership(c));
log.error(pos, Errors.CyclicPrimitiveClassMembership(c));
return;
}
try {
@@ -2696,7 +2696,7 @@ void checkCompatibleSupertypes(DiagnosticPosition pos, Type c) {
checkCompatibleConcretes(pos, c);

if (c.isValue() && types.asSuper(c, syms.identityObjectType.tsym, true) != null) {
log.error(pos, Errors.InlineTypeMustNotImplementIdentityObject(c));
log.error(pos, Errors.PrimitiveClassMustNotImplementIdentityObject(c));
}
}

@@ -105,9 +105,9 @@
*/
boolean allowModules;

/** Switch: allow inline types.
/** Switch: allow primitive classes.
*/
boolean allowInlineTypes;
boolean allowPrimitiveClasses;

/** Switch: allow sealed
*/
@@ -276,7 +276,7 @@ protected ClassReader(Context context) {
Source source = Source.instance(context);
preview = Preview.instance(context);
allowModules = Feature.MODULES.allowedInSource(source);
allowInlineTypes = Feature.INLINE_TYPES.allowedInSource(source);
allowPrimitiveClasses = Feature.PRIMITIVE_CLASSES.allowedInSource(source);
allowRecords = Feature.RECORDS.allowedInSource(source);
allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
Feature.SEALED_CLASSES.allowedInSource(source);
@@ -813,7 +813,7 @@ private void initAttributeReaders() {

new AttributeReader(names.Code, V45_3, MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
if (allowInlineTypes) {
if (allowPrimitiveClasses) {
if (sym.isConstructor() && ((MethodSymbol) sym).type.getParameterTypes().size() == 0) {
int code_length = buf.getInt(bp + 4);
if ((code_length == 1 && buf.getByte( bp + 8) == (byte) ByteCodes.return_) ||
@@ -2506,7 +2506,7 @@ protected void enterTypevars(Symbol sym, Type t) {
}

protected ClassSymbol enterClass(Name name) {
if (allowInlineTypes && name.toString().endsWith("$ref")) {
if (allowPrimitiveClasses && name.toString().endsWith("$ref")) {
ClassSymbol v = syms.enterClass(currentModule, name.subName(0, name.length() - 4));
return v.referenceProjection();
}
@@ -2799,7 +2799,7 @@ long adjustClassFlags(long flags) {
}
if ((flags & ACC_INLINE) != 0) {
flags &= ~ACC_INLINE;
if (allowInlineTypes) {
if (allowPrimitiveClasses) {
flags |= VALUE;
}
}
@@ -3488,7 +3488,7 @@ Token recastToken(Token token) {
t == INTERFACE ||
t == ENUM ||
t == IDENTIFIER)) { // new value Comparable() {}
checkSourceLevel(Feature.INLINE_TYPES);
checkSourceLevel(Feature.PRIMITIVE_CLASSES);
return new Token(PRIMITIVE, token.pos, token.endPos, token.comments);
}
return token;
@@ -396,10 +396,6 @@ compiler.err.cont.outside.loop=\
compiler.err.cyclic.inheritance=\
cyclic inheritance involving {0}

# 0: symbol
compiler.err.cyclic.value.type.membership=\
cyclic inline type membership involving {0}

# 0: symbol
compiler.err.cyclic.annotation.element=\
type of element {0} is cyclic
@@ -1779,9 +1775,6 @@ compiler.warn.poor.choice.for.module.name=\
compiler.warn.incubating.modules=\
using incubating module(s): {0}

compiler.warn.get.class.compared.with.interface=\
return value of getClass() can never equal the class literal of an interface

# 0: symbol, 1: symbol
compiler.warn.has.been.deprecated=\
{0} in {1} has been deprecated
@@ -2959,9 +2952,6 @@ compiler.misc.feature.pattern.matching.instanceof=\
compiler.misc.feature.reifiable.types.instanceof=\
reifiable types in instanceof

compiler.misc.feature.inline.type=\
inline type

compiler.misc.feature.records=\
records

@@ -3792,61 +3782,71 @@ compiler.err.preview.not.latest=\
compiler.err.preview.without.source.or.release=\
--enable-preview must be used with either -source or --release

compiler.misc.feature.primitive.classes=\
primitive classes

# 0: symbol
compiler.err.cyclic.primitive.class.membership=\
cyclic primitive class membership involving {0}

compiler.warn.get.class.compared.with.interface=\
return value of getClass() can never equal the class literal of an interface

# 0: name (of method)
compiler.err.inline.class.may.not.override=\
Inline classes may not override the method {0} from Object
compiler.err.primitive.class.may.not.override=\
primitive classes may not override the method {0} from Object

# 0: name (of method)
compiler.err.value.does.not.support=\
Inline types do not support {0}
compiler.err.primitive.class.does.not.support=\
primitive classes do not support {0}

compiler.err.value.may.not.extend=\
Inline type may not extend another inline type or class
compiler.err.primitive.class.may.not.extend=\
inappropriate super class declaration for a primitive class

compiler.err.value.instance.field.expected.here=\
withfield operator requires an instance field of an inline class here
compiler.err.primitive.class.instance.field.expected.here=\
withfield operator requires an instance field of a primitive class here

compiler.err.with.field.operator.disallowed=\
WithField operator is allowed only with -XDallowWithFieldOperator

compiler.err.this.exposed.prematurely=\
Inine type instance should not be passed around before being fully initialized
primitive class instance should not be passed around before being fully initialized

# 0: type
compiler.err.generic.parameterization.with.value.type=\
Inferred type {0} involves generic parameterization by an inline type
compiler.err.generic.parameterization.with.primitive.class=\
Inferred type {0} involves generic parameterization by a primitive class

# 0: type
compiler.err.inline.type.must.not.implement.identity.object=\
The inline type {0} attempts to implement the incompatible interface IdentityObject
compiler.err.primitive.class.must.not.implement.identity.object=\
The primitive class {0} attempts to implement the incompatible interface IdentityObject

# 0: symbol, 1: type
compiler.err.concrete.supertype.for.inline.class=\
The concrete class {1} is not allowed to be a super class of the inline class {0} either directly or indirectly
compiler.err.concrete.supertype.for.primitive.class=\
The concrete class {1} is not allowed to be a super class of the primitive class {0} either directly or indirectly

# 0: symbol, 1: symbol, 2: type
compiler.err.super.method.cannot.be.synchronized=\
The method {0} in the super class {2} of the inline type {1} is synchronized. This is disallowed
The method {0} in the super class {2} of the primitive class {1} is synchronized. This is disallowed

# 0: symbol, 1: symbol, 2: type
compiler.err.super.constructor.cannot.take.arguments=\
The super class {2} of the inline type {1} defines a constructor {0} that takes arguments. This is disallowed
The super class {2} of the primitive class {1} defines a constructor {0} that takes arguments. This is disallowed

# 0: symbol, 1: symbol, 2: type
compiler.err.super.field.not.allowed=\
The super class {2} of the inline type {1} defines an instance field {0}. This is disallowed
The super class {2} of the primitive class {1} defines an instance field {0}. This is disallowed

# 0: symbol, 1: symbol, 2: type
compiler.err.super.no.arg.constructor.must.be.empty=\
The super class {2} of the inline type {1} defines a nonempty no-arg constructor {0}. This is disallowed
The super class {2} of the primitive class {1} defines a nonempty no-arg constructor {0}. This is disallowed

# 0: symbol, 1: type
compiler.err.super.class.declares.init.block=\
The super class {1} of the inline class {0} declares one or more non-empty instance initializer blocks. This is disallowed.
The super class {1} of the primitive class {0} declares one or more non-empty instance initializer blocks. This is disallowed.

# 0: symbol, 1: type
compiler.err.super.class.cannot.be.inner=\
The super class {1} of the inline class {0} is an inner class. This is disallowed.
The super class {1} of the primitive class {0} is an inner class. This is disallowed.

compiler.err.projection.cant.be.instantiated=\
Illegal attempt to instantiate a projection type
@@ -205,16 +205,16 @@ compiler.err.preview.not.latest
compiler.err.preview.without.source.or.release

# Value types
compiler.err.cyclic.value.type.membership
compiler.err.value.does.not.support
compiler.err.value.may.not.extend
compiler.err.cyclic.primitive.class.membership
compiler.err.primitive.class.does.not.support
compiler.err.primitive.class.may.not.extend
compiler.err.this.exposed.prematurely
compiler.err.inline.type.must.not.implement.identity.object
compiler.err.concrete.supertype.for.inline.class
compiler.err.primitive.class.must.not.implement.identity.object
compiler.err.concrete.supertype.for.primitive.class
compiler.err.super.class.cannot.be.inner
compiler.err.super.class.declares.init.block
compiler.err.super.constructor.cannot.take.arguments
compiler.err.super.field.not.allowed
compiler.err.super.method.cannot.be.synchronized
compiler.err.super.no.arg.constructor.must.be.empty
compiler.err.generic.parameterization.with.value.type
compiler.err.generic.parameterization.with.primitive.class
@@ -22,7 +22,7 @@
*/

// options: -XDallowWithFieldOperator
// key: compiler.err.value.instance.field.expected.here
// key: compiler.err.primitive.class.instance.field.expected.here

final primitive class Blah {
final int x;
@@ -21,7 +21,7 @@
* questions.
*/

// key: compiler.err.inline.class.may.not.override
// key: compiler.err.primitive.class.may.not.override

primitive class InlineBogusOverride {
int x = 42;
@@ -22,7 +22,7 @@
*/

// key: compiler.err.feature.not.supported.in.source
// key: compiler.misc.feature.inline.type
// key: compiler.misc.feature.primitive.classes
// key: compiler.warn.source.no.system.modules.path
// options: -source 13

@@ -1,4 +1,4 @@
BinarySuperclassConstraints.java:14:15: compiler.err.inline.type.must.not.implement.identity.object: BinarySuperclassConstraints.I0
BinarySuperclassConstraints.java:14:15: compiler.err.primitive.class.must.not.implement.identity.object: BinarySuperclassConstraints.I0
BinarySuperclassConstraints.java:29:15: compiler.err.super.field.not.allowed: x, BinarySuperclassConstraints.I6, SuperclassCollections.SuperWithInstanceField
BinarySuperclassConstraints.java:38:15: compiler.err.super.no.arg.constructor.must.be.empty: SuperclassCollections.SuperWithNonEmptyNoArgCtor(), BinarySuperclassConstraints.I9, SuperclassCollections.SuperWithNonEmptyNoArgCtor
BinarySuperclassConstraints.java:40:15: compiler.err.super.constructor.cannot.take.arguments: SuperclassCollections.SuperWithArgedCtor(java.lang.String), BinarySuperclassConstraints.I10, SuperclassCollections.SuperWithArgedCtor
@@ -1,6 +1,6 @@
CheckClone.java:11:21: compiler.err.value.does.not.support: clone
CheckClone.java:12:18: compiler.err.value.does.not.support: clone
CheckClone.java:16:16: compiler.err.value.does.not.support: clone
CheckClone.java:17:14: compiler.err.value.does.not.support: clone
CheckClone.java:20:22: compiler.err.inline.class.may.not.override: clone
CheckClone.java:11:21: compiler.err.primitive.class.does.not.support: clone
CheckClone.java:12:18: compiler.err.primitive.class.does.not.support: clone
CheckClone.java:16:16: compiler.err.primitive.class.does.not.support: clone
CheckClone.java:17:14: compiler.err.primitive.class.does.not.support: clone
CheckClone.java:20:22: compiler.err.primitive.class.may.not.override: clone
5 errors
@@ -1,4 +1,4 @@
CheckCyclicMembership.java:13:37: compiler.err.cyclic.value.type.membership: CheckCyclicMembership.InnerValue
CheckCyclicMembership.java:15:33: compiler.err.cyclic.value.type.membership: CheckCyclicMembership
CheckCyclicMembership.java:19:22: compiler.err.cyclic.value.type.membership: CheckCyclicMembership
CheckCyclicMembership.java:13:37: compiler.err.cyclic.primitive.class.membership: CheckCyclicMembership.InnerValue
CheckCyclicMembership.java:15:33: compiler.err.cyclic.primitive.class.membership: CheckCyclicMembership
CheckCyclicMembership.java:19:22: compiler.err.cyclic.primitive.class.membership: CheckCyclicMembership
3 errors
@@ -1,2 +1,2 @@
CheckExtends.java:10:22: compiler.err.inline.type.must.not.implement.identity.object: CheckExtends.NestedValue
CheckExtends.java:10:22: compiler.err.primitive.class.must.not.implement.identity.object: CheckExtends.NestedValue
1 error
@@ -1,2 +1,2 @@
CheckFeatureGate1.java:10:12: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.inline.type), 13, 17
CheckFeatureGate1.java:10:12: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.primitive.classes), 13, 17
1 error
@@ -1,2 +1,2 @@
CheckFeatureGate2.java:11:17: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.inline.type), 13, 17
CheckFeatureGate2.java:11:17: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.primitive.classes), 13, 17
1 error

0 comments on commit dad7d19

Please sign in to comment.