Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException on SameNameButDifferent #3245

Open
ilopezv opened this issue Jun 6, 2022 · 2 comments
Open

java.lang.NullPointerException on SameNameButDifferent #3245

ilopezv opened this issue Jun 6, 2022 · 2 comments

Comments

@ilopezv
Copy link

ilopezv commented Jun 6, 2022

Error obtained with maven 3.8.5 and Java 11.0.14 with the following config:

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<configuration>
						<source>${maven.compiler.source}</source>
						<target>${maven.compiler.target}</target>
						<release>${maven.compiler.release}</release>
						<encoding>${project.build.sourceEncoding}</encoding>
						<showDeprecation>false</showDeprecation>
						<showWarnings>false</showWarnings>
						<annotationProcessorPaths>
							<path>
								<groupId>org.springframework.boot</groupId>
								<artifactId>spring-boot-configuration-processor</artifactId>
								<version>${spring-boot-starter-parent.version}</version>
							</path>
							<path>
								<groupId>org.mapstruct</groupId>
								<artifactId>mapstruct-processor</artifactId>
								<version>${org.mapstruct.version}</version>
							</path>
							<path>
								<groupId>org.projectlombok</groupId>
								<artifactId>lombok</artifactId>
								<version>${lombok.version}</version>
							</path>
							<path>
								<groupId>org.projectlombok</groupId>
								<artifactId>lombok-mapstruct-binding</artifactId>
								<version>${lombok-mapstruct-binding.version}</version>
							</path>
							<path>
								<groupId>org.springframework</groupId>
								<artifactId>spring-context-indexer</artifactId>
								<version>${spring-framework.version}</version>
							</path>
	                        <path>
	                            <groupId>com.github.therapi</groupId>
	                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
	                            <version>${therapi-runtime-javadoc-scribe.version}</version>
	                        </path>
				            <path>
				              <groupId>com.google.errorprone</groupId>
				              <artifactId>error_prone_core</artifactId>
				              <version>${error_prone.version}</version>
				            </path>
						</annotationProcessorPaths>
						<!-- indicates mapstruct to generar -->
						<compilerArgs>
							<compilerArg>-Amapstruct.defaultComponentModel=spring</compilerArg>
							<compilerArg>-Amapstruct.defaultInjectionStrategy=constructor</compilerArg>
							<compilerArg>-XDcompilePolicy=simple</compilerArg>
							<compilerArg>-Xplugin:ErrorProne</compilerArg>
						</compilerArgs>
					</configuration>
				</plugin>
[ERROR]      error-prone version: 2.14.0
[ERROR]      BugPattern: SameNameButDifferent
[ERROR]      Stack Trace:
[ERROR]      java.lang.NullPointerException
[ERROR]   	at com.google.errorprone.bugpatterns.SameNameButDifferent.getBetterImport(SameNameButDifferent.java:186)
[ERROR]   	at com.google.errorprone.bugpatterns.SameNameButDifferent.matchCompilationUnit(SameNameButDifferent.java:141)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:555)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[ERROR]   	at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
[ERROR]   	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:136)
[ERROR]   	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:182)
[ERROR]   	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1209)
[ERROR]   	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:198)
[ERROR]   	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]   	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
[ERROR]   	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
[ERROR]   	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]   	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]   	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
[ERROR]   	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
[ERROR]   	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
[ERROR]   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]   	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
@ilopezv
Copy link
Author

ilopezv commented Jun 6, 2022

-XepDisableWarningsInGeneratedCode seems to fix the bug

@ilopezv ilopezv changed the title java.lang.NullPointerException java.lang.NullPointerException on SameNameButDifferent Jun 6, 2022
@tbroyer
Copy link
Contributor

tbroyer commented Jun 8, 2022

Duplicate of #2977

copybara-service bot pushed a commit that referenced this issue Jul 14, 2022
Fixes(?) external #3245.

(I haven't included a test as the external bug doesn't have a repro, and is apparently in generated code: which makes me assume something odd is going on.)

PiperOrigin-RevId: 458755521
copybara-service bot pushed a commit that referenced this issue Jul 14, 2022
Fixes(?) external #3245.

(I haven't included a test as the external bug doesn't have a repro, and is apparently in generated code: which makes me assume something odd is going on.)

PiperOrigin-RevId: 460918647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants