[lworld] RFR: 8279656: [lworld] Javac diagnostic compiler.err.primitive.class.must.not.implement.cloneable not valid anymore

Srikanth Adayapalam sadayapalam at openjdk.java.net
Mon Jan 17 09:44:01 UTC 2022


On Fri, 14 Jan 2022 10:39:29 GMT, Aggelos Biboudis <duke at openjdk.java.net> wrote:

> Elides the restriction for `Cloneable`.

Changes requested by sadayapalam (Committer).

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java line 725:

> 723:                 if (it.hasTag(CLASS)) {
> 724:                     if (isPrimitiveClass && it.tsym == syms.cloneableType.tsym) {
> 725:                         log.error(tree, Errors.PrimitiveClassMustNotImplementCloneable(ct));

I think this leaves the local variable isPrimitiveClass unused and in need of garbage collection. (There used to be multiple uses at some point past - that explains the local variable but these uses have fell away one by one)

test/langtools/tools/javac/valhalla/lworld-values/T8279656.java line 11:

> 9:     primitive class Primitive implements Cloneable {
> 10:     }
> 11: }

First I thought we may need a similar test in value-objects directory since value objects will get integrated ahead of and independently of primitive classes - but value objects are new and so were never restricted in the first place - so perhaps we don't need a test there after all.

-------------

PR: https://git.openjdk.java.net/valhalla/pull/603



More information about the valhalla-dev mailing list