Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-dev] ECJ + maven + release 8 flag = unexpected Unnecessary cast

Hi Team

I have the following problem.

1. There is the code, similar to this:
          ByteBuffer b = getHeaderBytes();
          C.c((ByteBuffer)(b.duplicate().rewind()));

2. When compiled with ecj manually, with --release 8, under JDK11,
everything is fine.

3. When ecj is used in maven, the produced class is in proper version.
It indicates that the release flag is passed correctly by compiler
plugin and is used by ecj.
But for the above code "Unnecessary cast from java.nio.ByteBuffer to
java.nio.ByteBuffer" is reported. If this is set to error, the build
obviously fails.
I want it to be the error, but I'd like the maven build to pass as
well, the same as manual compilation does.
In other words, I'd like ecj in maven build to handle the change in
ByteBuffer between JDK8 and JDK11.

I prepared a reproducer: https://github.com/pzrep/ecj-release-8.

As I might be missing some configuration, before filing the bug,
perhaps someone on this list could help me sort it out.

-- 
Piotrek


Back to the top