Discussion:
[tycho-user] NullPointerException with Java 9 and Tycho 1.1.0
Katrin STRASSL
2018-02-14 13:16:22 UTC
Permalink
Hi,

I've started migrating our projects to Java 9 / Tycho 1.1.0 and now I get
a NullPointerException during compilation.

[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-compiler-plugin:1.1.0:compile (default-compile) on
project my.project.name: Compilation failure: Compilation failure:
[ERROR]
D:\workspace\parent_project\my_project\src\main\java\my\project\name\TransactionServiceImpl.java:
[ERROR] package my.project.name;
[ERROR] ^
[ERROR] Internal compiler error: java.lang.NullPointerException at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(
BinaryModuleBinding.java:64)
[ERROR] java.lang.NullPointerException
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(
BinaryModuleBinding.java:64)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getModuleFromAnswer(
LookupEnvironment.java:423)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(
LookupEnvironment.java:363)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(
LookupEnvironment.java:224)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(
UnresolvedReferenceBinding.java:105)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(
BinaryTypeBinding.java:215)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(
PackageBinding.java:236)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(
CompilationUnitScope.java:527)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(
CompilationUnitScope.java:586)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(
CompilationUnitScope.java:435)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(
CompilationUnitScope.java:501)
[ERROR] at org.eclipse.jdt.internal.compiler.Compiler.process(
Compiler.java:878)
[ERROR] at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(
ProcessTaskManager.java:141)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:844)

Strangely, the project where the compilation fails is not the first
submodule - the first five or six submodules compile perfectly fine and
then on this module the compiler crashes.

To get closer to the source of the problem I tried the following:

- I manually forced tycho-compiler-plugin to use the previous version of
JDT

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.13.50.v20171007-0855</version>
</dependency>
</dependencies>
</plugin>

I am aware that even if this had worked, it would be a suboptimal
solution, but it was worth a try. When I ran the tycho build in an
existing workspace, this configuration actually worked! But on a clean
workspace it failed and complained about Fatal error compiling: Compliance
level '1.4' is incompatible with target level '9'. A compliance level '9'
or better is required because in the clean workspace there exist no
.settings/org.eclipse.jdt.core.prefs. As ultimately I'd like my projects
to compile with "standard" tycho anyway, I did not follow this path
further.

- I discovered that the actual JDT version used by the current tycho
release is 3.14.0.v20171206-0802 and downloaded a fresh eclipse that comes
with exactly this JDT version.

This is the case for eclipse photon M4 (M5 already comes with JDT version
3.15), so I downloaded it and imported my projects. Eclipse does not
report an error and also all JUnit-Tests that use the above mentioned
project run fine.
Actually I had hoped that I could reproduce the error in that eclipse
version and that I could use that to find a solution (maybe it's a project
misconfiguration or similar).


I'm a bit clueless on how to progress from here and what I could try to
pin down the problem further. Please remember that it's not a general
problem but several submodules compile without exception. I could not find
an obvious configuration difference between the working modules and the
crashing one.

Does anyone have an idea how to progress? I'm asking here first because
everything seemed to work fine from within eclipse itself. If you need
further information to tackle the problem, I'll be glad to provide it.

Thanks,
Katrin
Katrin STRASSL
2018-02-14 14:32:49 UTC
Permalink
In case it helps, here is the full debug output from tycho-compiler-plugin
for the failing module. I've just shortened the classpath and other
lengthy parameters.

[INFO] --- tycho-compiler-plugin:1.1.0:compile (default-compile) @
my.project.name ---
[DEBUG] Configuring mojo
org.eclipse.tycho:tycho-compiler-plugin:1.1.0:compile from plugin realm
ClassRealm[plugin>org.eclipse.tycho:tycho-compiler-plugin:1.1.0, parent:
jdk.internal.loader.ClassLoaders$***@3b764bce]
[DEBUG] Configuring mojo
'org.eclipse.tycho:tycho-compiler-plugin:1.1.0:compile' with basic
configurator -->
[DEBUG] (f) basedir = D:\workspace\parent_project\my_project
[DEBUG] (f) buildDirectory =
D:\workspace\parent_project\my_project\target
[DEBUG] (f) compilerId = jdt
[DEBUG] (f) copyResources = true
[DEBUG] (f) debug = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) fork = false
[DEBUG] (f) generatedSourcesDirectory =
D:\workspace\parent_project\my_project\target\generated-sources\annotations
[DEBUG] (f) logDirectory =
D:\workspace\parent_project\my_project\target\compile-logs
[DEBUG] (f) optimize = false
[DEBUG] (f) outputFileName = my.project.name-0.0.1-SNAPSHOT
[DEBUG] (f) project = MavenProject: my.project.name:0.0.1-SNAPSHOT @
D:\workspace\parent_project\my_project\pom.xml
[DEBUG] (f) requireJREPackageImports = false
[DEBUG] (f) session = ***@7100b724
[DEBUG] (f) showDeprecation = false
[DEBUG] (f) showWarnings = false
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) strictCompilerTarget = false
[DEBUG] (f) useJDK = SYSTEM
[DEBUG] (f) useProjectSettings = true
[DEBUG] (f) verbose = false
[DEBUG] -- end configuration --
[DEBUG] Manifest BREEs: [OSGi profile 'JavaSE-9' { source level: 9, target
level: 9}]
[DEBUG] Effective EE: OSGi profile 'JavaSE-9' { source level: 9, target
level: 9}
[DEBUG] Effective source/target: 9/9
[DEBUG] Using compiler 'jdt'.
[DEBUG] Source directories:
[D:\workspace\parent_project\my_project\src\main\java
D:\workspace\parent_project\my_project\src\main\resources]
[DEBUG] Classpath: [D:\workspace\parent_project\my_project\target\classes

C:\Users\user\.m2\repository\p2\osgi\bundle\com.google.guava\23.0.0\com.google.guava-23.0.0.jar[+com/google/common/base/*;?**/*]
...snip...]
[DEBUG] Output directory:
D:\workspace\parent_project\my_project\target\classes
[DEBUG] Classpath:
[DEBUG] D:\workspace\parent_project\my_project\target\classes
[DEBUG]
C:\Users\user\.m2\repository\p2\osgi\bundle\com.google.guava\23.0.0\com.google.guava-23.0.0.jar[+com/google/common/base/*;?**/*]
[DEBUG] ...snip...
[DEBUG] Source roots:
[DEBUG] D:\workspace\parent_project\my_project\src\main\java
[DEBUG] D:\workspace\parent_project\my_project\src\main\resources
[INFO] Compiling 77 source files to
D:\workspace\parent_project\my_project\target\classes
[DEBUG] JDT compiler args: [-s,
D:\workspace\parent_project\my_project\target\generated-sources\annotations,
-d, D:\workspace\parent_project\my_project\target\classes, -classpath,
D:\workspace\parent_project\my_project\target\classes;C:\Users\user\.m2\repository\p2\osgi\bundle\com.google.guava\23.0.0\com.google.guava-23.0.0.jar[+com/google/common/base/*;?**/*];...more
classpath entries...,
D:\workspace\parent_project\my_project\src\main\java\my\project\name\TransactionServiceImpl.java,
...more source files..., -g, -nowarn, -target, 9, -source, 9, -encoding,
UTF-8]
[DEBUG] Original compiler output: ----------
1. ERROR in
D:\workspace\parent_project\my_project\src\main\java\my\project\name\TransactionServiceImpl.java
(at line 0)
package my.project.name;
^
Internal compiler error: java.lang.NullPointerException at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(BinaryModuleBinding.java:64)
----------
java.lang.NullPointerException
at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(BinaryModuleBinding.java:64)
at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getModuleFromAnswer(LookupEnvironment.java:423)
at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:363)
at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:224)
at
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:105)
at
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:215)
at
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:236)
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:527)
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:586)
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(CompilationUnitScope.java:435)
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:501)
at
org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:878)
at
org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:141)
at java.base/java.lang.Thread.run(Thread.java:844)
Jeff MAURY
2018-02-14 22:05:25 UTC
Permalink
Why are you using a specific version of jdt? It's likely Java 9 support
breaks

Jeff

Le 14 févr. 2018 14:16, "Katrin STRASSL" <
Post by Katrin STRASSL
Hi,
I've started migrating our projects to Java 9 / Tycho 1.1.0 and now I get
a NullPointerException during compilation.
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.1.0:compile
[ERROR] D:\workspace\parent_project\my_project\src\main\java\my\
[ERROR] package my.project.name;
[ERROR] ^
[ERROR] Internal compiler error: *java.lang.NullPointerException* at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(
*BinaryModuleBinding.java:64*)
[ERROR] *java.lang.NullPointerException*
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.
BinaryModuleBinding.create(*BinaryModuleBinding.java:64*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.
getModuleFromAnswer(*LookupEnvironment.java:423*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.
askForTypeFromModules(*LookupEnvironment.java:363*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.
LookupEnvironment.askForType(*LookupEnvironment.java:224*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.
UnresolvedReferenceBinding.resolve(*UnresolvedReferenceBinding.java:105*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.
BinaryTypeBinding.resolveType(*BinaryTypeBinding.java:215*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.
getTypeOrPackage(*PackageBinding.java:236*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.
findImport(*CompilationUnitScope.java:527*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.
findSingleImport(*CompilationUnitScope.java:586*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.
faultInImports(*CompilationUnitScope.java:435*)
[ERROR] at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.
faultInTypes(*CompilationUnitScope.java:501*)
[ERROR] at org.eclipse.jdt.internal.compiler.Compiler.process(
*Compiler.java:878*)
[ERROR] at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(
*ProcessTaskManager.java:141*)
[ERROR] at java.base/java.lang.Thread.run(*Thread.java:844*)
Strangely, the project where the compilation fails is not the first
submodule - the first five or six submodules compile perfectly fine and
then on this module the compiler crashes.
- I manually forced tycho-compiler-plugin to use the previous version of
JDT
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>*tycho*-compiler-*plugin*</artifactId>
<version>${*tycho*-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.13.50.v20171007-0855</version>
</dependency>
</dependencies>
</plugin>
I am aware that even if this had worked, it would be a suboptimal
solution, but it was worth a try. When I ran the tycho build in an existing
workspace, this configuration actually worked! But on a clean workspace it
failed and complained about Fatal error compiling: Compliance level '1.4'
is incompatible with target level '9'. A compliance level '9' or better is
required because in the clean workspace there exist no
.settings/org.eclipse.jdt.core.prefs. As ultimately I'd like my projects
to compile with "standard" tycho anyway, I did not follow this path further.
- I discovered that the actual JDT version used by the current tycho
release is 3.14.0.v20171206-0802 and downloaded a fresh eclipse that comes
with exactly this JDT version.
This is the case for eclipse photon M4 (M5 already comes with JDT version
3.15), so I downloaded it and imported my projects. Eclipse does not report
an error and also all JUnit-Tests that use the above mentioned project run
fine.
Actually I had hoped that I could reproduce the error in that eclipse
version and that I could use that to find a solution (maybe it's a project
misconfiguration or similar).
I'm a bit clueless on how to progress from here and what I could try to
pin down the problem further. Please remember that it's not a general
problem but several submodules compile without exception. I could not find
an obvious configuration difference between the working modules and the
crashing one.
Does anyone have an idea how to progress? I'm asking here first because
everything seemed to work fine from within eclipse itself. If you need
further information to tackle the problem, I'll be glad to provide it.
Thanks,
Katrin
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Katrin STRASSL
2018-02-15 07:55:21 UTC
Permalink
I am not, it was just a try to see if it is a bug in this specific JDT
version and if it would work with another one. As I said, I didn't follow
this path further and am back to the default JDT version (currently
3.14.0.v20171206-0802, like in eclipse photon M4).
Katrin



Von: Jeff MAURY <***@gmail.com>
An: Tycho user list <tycho-***@eclipse.org>,
Datum: 14.02.2018 23:05
Betreff: Re: [tycho-user] NullPointerException with Java 9 and
Tycho 1.1.0
Gesendet von: tycho-user-***@eclipse.org



Why are you using a specific version of jdt? It's likely Java 9 support
breaks

Jeff

Le 14 févr. 2018 14:16, "Katrin STRASSL" <
***@sprecher-automation.com> a écrit :
Hi,

I've started migrating our projects to Java 9 / Tycho 1.1.0 and now I get
a NullPointerException during compilation.

[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-compiler-plugin:1.1.0:compile (default-compile) on
project my.project.name: Compilation failure: Compilation failure:
[ERROR]
D:\workspace\parent_project\my_project\src\main\java\my\project\name\TransactionServiceImpl.java:

[ERROR] package my.project.name;
[ERROR] ^
[ERROR] Internal compiler error: java.lang.NullPointerException at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(
BinaryModuleBinding.java:64)
[ERROR] java.lang.NullPointerException
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.BinaryModuleBinding.create(
BinaryModuleBinding.java:64)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getModuleFromAnswer(
LookupEnvironment.java:423)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(
LookupEnvironment.java:363)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(
LookupEnvironment.java:224)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(
UnresolvedReferenceBinding.java:105)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(
BinaryTypeBinding.java:215)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(
PackageBinding.java:236)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(
CompilationUnitScope.java:527)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(
CompilationUnitScope.java:586)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInImports(
CompilationUnitScope.java:435)
[ERROR] at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(
CompilationUnitScope.java:501)
[ERROR] at org.eclipse.jdt.internal.compiler.Compiler.process(
Compiler.java:878)
[ERROR] at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(
ProcessTaskManager.java:141)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:844)

Strangely, the project where the compilation fails is not the first
submodule - the first five or six submodules compile perfectly fine and
then on this module the compiler crashes.

To get closer to the source of the problem I tried the following:

- I manually forced tycho-compiler-plugin to use the previous version of
JDT

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.13.50.v20171007-0855</version>
</dependency>
</dependencies>
</plugin>

I am aware that even if this had worked, it would be a suboptimal
solution, but it was worth a try. When I ran the tycho build in an
existing workspace, this configuration actually worked! But on a clean
workspace it failed and complained about Fatal error compiling: Compliance
level '1.4' is incompatible with target level '9'. A compliance level '9'
or better is required because in the clean workspace there exist no
.settings/org.eclipse.jdt.core.prefs. As ultimately I'd like my projects
to compile with "standard" tycho anyway, I did not follow this path
further.

- I discovered that the actual JDT version used by the current tycho
release is 3.14.0.v20171206-0802 and downloaded a fresh eclipse that comes
with exactly this JDT version.

This is the case for eclipse photon M4 (M5 already comes with JDT version
3.15), so I downloaded it and imported my projects. Eclipse does not
report an error and also all JUnit-Tests that use the above mentioned
project run fine.
Actually I had hoped that I could reproduce the error in that eclipse
version and that I could use that to find a solution (maybe it's a project
misconfiguration or similar).


I'm a bit clueless on how to progress from here and what I could try to
pin down the problem further. Please remember that it's not a general
problem but several submodules compile without exception. I could not find
an obvious configuration difference between the working modules and the
crashing one.

Does anyone have an idea how to progress? I'm asking here first because
everything seemed to work fine from within eclipse itself. If you need
further information to tackle the problem, I'll be glad to provide it.

Thanks,
Katrin
_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user

Loading...