Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-1117

Exception when duplicated method in source

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.1.2
    • Component/s: Compiler
    • Sprint:
      4.1.2

      Description

      Create a project with the following classes:

      class Hello
      {
          public void xsomeMethod()
          {
          }
      
          public void xsomeMethod()
          {
          }
      }
      

      and

      public class Rhubarb
      {
          public Rhubarb()
          {
              new Hello().someMethod();
          }
      }
      

      The following exception is thrown when the project opens:

      Exception during compilation: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Duplicate key bluej.debugger.gentype.MethodReflective@4159bf0d
      java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Duplicate key bluej.debugger.gentype.MethodReflective@4159bf0d
      	at com.sun.tools.javac.main.Main.compile(Main.java:559)
      	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
      	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
      	at bluej.compiler.CompilerAPICompiler.compile(CompilerAPICompiler.java:231)
      	at bluej.compiler.Job.compile(Job.java:107)
      	at bluej.compiler.CompilerThread.run(CompilerThread.java:72)
      Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Duplicate key bluej.debugger.gentype.MethodReflective@4159bf0d
      	at bluej.compiler.EventqueueCompileObserverAdapter.runOnEventQueue(EventqueueCompileObserverAdapter.java:74)
      	at bluej.compiler.EventqueueCompileObserverAdapter.compilerMessage(EventqueueCompileObserverAdapter.java:87)
      	at bluej.compiler.CompilerAPICompiler$1.report(CompilerAPICompiler.java:181)
      	at com.sun.tools.javac.api.ClientCodeWrapper$WrappedDiagnosticListener.report(ClientCodeWrapper.java:593)
      	at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:616)
      	at com.sun.tools.javac.util.Log$DefaultDiagnosticHandler.report(Log.java:600)
      	at com.sun.tools.javac.util.Log.report(Log.java:562)
      	at com.sun.tools.javac.comp.Resolve.logResolveError(Resolve.java:3514)
      	at com.sun.tools.javac.comp.Resolve.accessInternal(Resolve.java:2219)
      	at com.sun.tools.javac.comp.Resolve.accessMethod(Resolve.java:2237)
      	at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.access(Resolve.java:3111)
      	at com.sun.tools.javac.comp.Resolve$9.access(Resolve.java:2443)
      	at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3353)
      	at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2433)
      	at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2427)
      	at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3396)
      	at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3278)
      	at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
      	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      	at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1825)
      	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      	at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:625)
      	at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1593)
      	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
      	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
      	at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
      	at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1124)
      	at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
      	at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1013)
      	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      	at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      	at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
      	at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4364)
      	at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4272)
      	at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
      	at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4176)
      	at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
      	at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      	at com.sun.tools.javac.main.Main.compile(Main.java:523)
      	... 5 more
      Caused by: java.lang.IllegalStateException: Duplicate key bluej.debugger.gentype.MethodReflective@4159bf0d
      	at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
      	at java.util.HashMap.merge(HashMap.java:1253)
      	at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
      	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      	at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1548)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at bluej.pkgmgr.ProjectJavadocResolver.getJavadoc(ProjectJavadocResolver.java:91)
      	at bluej.parser.ParseUtils.discoverElements(ParseUtils.java:241)
      	at bluej.parser.ParseUtils.getCompletionsForTarget(ParseUtils.java:172)
      	at bluej.parser.ParseUtils.getPossibleCompletions(ParseUtils.java:86)
      	at bluej.pkgmgr.Package$MisspeltMethodChecker.calculateMessage(Package.java:2734)
      	at bluej.pkgmgr.Package.showEditorDiagnostic(Package.java:2269)
      	at bluej.pkgmgr.Package.access$3(Package.java:2252)
      	at bluej.pkgmgr.Package$PackageCompileObserver.errorMessage(Package.java:2836)
      	at bluej.pkgmgr.Package$PackageCompileObserver.compilerMessage(Package.java:2810)
      	at bluej.collect.DataCollectionCompileObserverWrapper.compilerMessage(DataCollectionCompileObserverWrapper.java:73)
      	at bluej.compiler.EventqueueCompileObserverAdapter.lambda$1(EventqueueCompileObserverAdapter.java:87)
      	at bluej.compiler.EventqueueCompileObserverAdapter.lambda$0(EventqueueCompileObserverAdapter.java:58)
      	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
      	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      	at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Activity

            People

            • Assignee:
              davmac Davin McCall
              Reporter:
              davmac Davin McCall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: