Cannot invoke "com.sun.tools.javac.code.Symbol$MethodSymbol.flags()" because "com.sun.tools.javac.code.Types.interfaceCandidates(com.sun.tools.javac.code.Type, com.sun.tools.javac.code.Symbol$MethodSymbol).head" is null

XMLWordPrintable

    • windows

      ADDITIONAL SYSTEM INFORMATION :
      Property settings:
          file.encoding = UTF-8
          file.separator = \
          java.class.path = .
          java.class.version = 65.0
          java.home = C:\Program Files\Eclipse Adoptium\jdk-21.0.10.7-hotspot
          java.io.tmpdir = <redacted>
          java.library.path = <redacted>
          java.runtime.name = OpenJDK Runtime Environment
          java.runtime.version = 21.0.10+7-LTS
          java.specification.name = Java Platform API Specification
          java.specification.vendor = Oracle Corporation
          java.specification.version = 21
          java.vendor = Eclipse Adoptium
          java.vendor.url = https://adoptium.net/
          java.vendor.url.bug = https://github.com/adoptium/adoptium-support/issues
          java.vendor.version = Temurin-21.0.10+7
          java.version = 21.0.10
          java.version.date = 2026-01-20
          java.vm.compressedOopsMode = Zero based
          java.vm.info = mixed mode, sharing
          java.vm.name = OpenJDK 64-Bit Server VM
          java.vm.specification.name = Java Virtual Machine Specification
          java.vm.specification.vendor = Oracle Corporation
          java.vm.specification.version = 21
          java.vm.vendor = Eclipse Adoptium
          java.vm.version = 21.0.10+7-LTS
          jdk.debug = release
          line.separator = \r \n
          native.encoding = Cp1252
          os.arch = amd64
          os.name = Windows 11
          os.version = 10.0
          path.separator = ;
          stderr.encoding = cp437
          stdout.encoding = cp437
          sun.arch.data.model = 64
          sun.boot.library.path = C:\Program Files\Eclipse Adoptium\jdk-21.0.10.7-hotspot\bin
          sun.cpu.endian = little
          sun.cpu.isalist = amd64
          sun.io.unicode.encoding = UnicodeLittle
          sun.java.launcher = SUN_STANDARD
          sun.jnu.encoding = Cp1252
          sun.management.compiler = HotSpot 64-Bit Tiered Compilers
          sun.os.patch.level =
          user.country = US
          user.dir = <redacted>
          user.home = <redacted>
          user.language = en
          user.name = <redacted>
          user.script =
          user.variant =

      openjdk version "21.0.10" 2026-01-20 LTS
      OpenJDK Runtime Environment Temurin-21.0.10+7 (build 21.0.10+7-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.10+7 (build 21.0.10+7-LTS, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      An exception has occurred in the compiler (21.0.10). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Symbol$MethodSymbol.flags()" because "com.sun.tools.javac.code.Types.interfaceCandidates(com.sun.tools.javac.code.Type, com.sun.tools.javac.code.Symbol$MethodSymbol).head" is null
      at jdk.compiler/com.sun.tools.javac.code.Types$DescriptorFilter.test(Types.java:1000)
      at jdk.compiler/com.sun.tools.javac.code.Types$DescriptorFilter.test(Types.java:987)
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl$1.skipToNextMatchingEntry(Scope.java:622)
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl$1.update(Scope.java:610)
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl$1.doNext(Scope.java:605)
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl$1.next(Scope.java:598)
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl$1.next(Scope.java:575)
      at jdk.compiler/com.sun.tools.javac.util.Iterators$CompoundIterator.next(Iterators.java:89)
      at jdk.compiler/com.sun.tools.javac.code.Types$DescriptorCache.findDescriptorInternal(Types.java:743)
      at jdk.compiler/com.sun.tools.javac.code.Types$DescriptorCache.get(Types.java:723)
      at jdk.compiler/com.sun.tools.javac.code.Types.findDescriptorSymbol(Types.java:823)
      at jdk.compiler/com.sun.tools.javac.code.Types.isFunctionalInterface(Types.java:839)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve$MostSpecificCheck$MostSpecificCheckContext.unrelatedFunctionalInterfaces(Resolve.java:1187)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve$MostSpecificCheck$MostSpecificCheckContext.compatible(Resolve.java:1167)
      at jdk.compiler/com.sun.tools.javac.comp.Check.checkType(Check.java:637)
      at jdk.compiler/com.sun.tools.javac.comp.Attr$ResultInfo.check(Attr.java:515)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve$MostSpecificCheck.argumentsAcceptable(Resolve.java:1136)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:631)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.instantiate(Resolve.java:677)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.signatureMoreSpecific(Resolve.java:1745)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:1663)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1641)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1790)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1861)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1834)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve$12.doLookup(Resolve.java:2762)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3477)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3729)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2759)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2753)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:4561)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4437)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2581)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2626)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:515)
      at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:495)
      at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:466)
      at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.lambda$processArg$0(ArgumentAttr.java:221)
      at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:243)
      at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:220)
      at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitApply(ArgumentAttr.java:314)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
      at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:198)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:660)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:763)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2617)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:715)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:2335)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1603)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1448)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1231)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:916)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5664)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5552)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5376)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5315)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1359)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:976)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
      at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:214)
      at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1228)
      at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:208)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
      at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
      at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
      at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
      at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
      at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
      at java.base/java.lang.reflect.Method.invoke(Method.java:580)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)

      This is perhaps the same problem as https://bugs.openjdk.org/browse/JDK-8323756, but might be triggered in a different way, since this appears to be caused by my "Aggressive Deprecation" annotation processor, which adds ACC_BRIDGE and ACC_SYNTHETIC to methods annotated with @AggressiveDeprecation, to make them invisible to javac, yet remain visible to the JRE itself.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac NPEs when an interface .class file contains a method with ACC_BRIDGE | ACC_ABSTRACT | ACC_SYNTHETIC flags, an unusual but valid bytecode combination (in my case, produced by an annotation processor). During overload resolution, javac calls isFunctionalInterface() on the interface type, which iterates
        methods via DescriptorFilter. The filter calls interfaceCandidates() for each method, but bridge+synthetic methods are excluded from the candidates, returning an empty list whose .head is null → NPE.

      ---------- BEGIN SOURCE ----------
      Please see the attached zip file.

      The reproducer can be triggered by running reproduce.bat. I didn't make a test harness for other platforms other than windows, but the procedure can be gleaned from the bat file, hopefully. Unfortunately, this cannot be boiled down to a simple reproduction, as it requires a complex combination of steps, but the project here reproduces it 100% of the time.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      In my case, because this is due to the annotation processor, I can simply not use it in the affected case (adding the annotation to an abstract class/interface method), but that defeats a lot of the purpose of the annotation processor.

      FREQUENCY :
      ALWAYS

            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: