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

[Bug] compiler error when using tuples directly as method parameters #488

Closed
CC007 opened this issue Sep 2, 2023 · 2 comments
Closed

[Bug] compiler error when using tuples directly as method parameters #488

CC007 opened this issue Sep 2, 2023 · 2 comments
Labels

Comments

@CC007
Copy link
Contributor

CC007 commented Sep 2, 2023

Describe the bug
I get an error when using a tuple as a method parameter (see stacktrace).

To Reproduce
Steps to reproduce the behavior:

  • create a class with a main method
  • add the following code to a java main method (any other method or constructor would also suffice)
var key = (1, 2);
Map<Object, String> map = new HashMap<>();
map[(1, 2)] = "foo";    // <-- this works
map.put(key, "foo");    // <-- this works
// map.put((1, 2), "foo"); <-- this doesn't work
System.out.println(map[(1, 2)]);     // <-- this works
System.out.println(map.get(key));    // <-- this works
// System.out.println(map.get((1, 2))); <-- this doesn't work
  • compile the code

Expected behavior
I expect the tuple to work as a method parameter just like a tuple variable works or as a tuple works in a [ ] notation.

Desktop (please complete the following information):

  • OS Type & Version: Windows 10
  • Java/JDK version: openjdk-20.0.2
  • IDE version (IntelliJ IDEA or Android Studio): IntelliJ 2023.1.5
  • Manifold version: 2023.1.19
  • Manifold IntelliJ plugin version: 23.1.15

Stack trace

java: An exception has occurred in the compiler (20.0.2). 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: java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Type.hasTag(com.sun.tools.javac.code.TypeTag)" because "found" is null
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1072)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ResolvedMemberType.overloadCheck(ArgumentAttr.java:645)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ArgumentType.complete(ArgumentAttr.java:356)
java: 	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:359)
java: 	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:343)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.checkSpeculative(ArgumentAttr.java:158)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.checkSpeculative(ArgumentAttr.java:149)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ParensType.overloadCheck(ArgumentAttr.java:414)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1074)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:901)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:789)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:910)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:632)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1585)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1791)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1862)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1835)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$12.doLookup(Resolve.java:2764)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3479)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3731)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2761)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2755)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:4515)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4391)
java: 	at manifold.internal.javac.ManAttr_17.visitSelect(ManAttr_17.java:143)
java: 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2547)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:663)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2591)
java: 	at manifold.internal.javac.ManAttr_17.visitApply(ManAttr_17.java:564)
java: 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1817)
java: 	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:500)
java: 	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:480)
java: 	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:467)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.lambda$processArg$0(ArgumentAttr.java:220)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:242)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:219)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitApply(ArgumentAttr.java:313)
java: 	at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:661)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:764)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2582)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:716)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:2300)
java: 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1604)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1440)
java: 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1088)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1230)
java: 	at manifold.internal.javac.ManAttr_17.visitMethodDef(ManAttr_17.java:214)
java: 	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:912)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5592)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5485)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5309)
java: 	at manifold.internal.javac.ManAttr_17.attribClass(ManAttr_17.java:1169)
java: 	at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5248)
java: 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1331)
java: 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
java: 	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java: 	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
java: 	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java: 	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java: 	at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:239)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava$2(JavaBuilder.java:524)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:587)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:522)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:366)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:291)
java: 	at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:245)
java: 	at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1553)
java: 	at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1183)
java: 	at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1333)
java: 	at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1148)
java: 	at org.jetbrains.jps.incremental.IncProjectBuilder$BuildParallelizer$1.run(IncProjectBuilder.java:1114)
java: 	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:248)
java: 	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:28)
java: 	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:221)
java: 	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:227)
java: 	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:210)
java: 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java: 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java: 	at java.base/java.lang.Thread.run(Thread.java:1623)
java: Compilation failed: internal java compiler error
rsmckinney added a commit that referenced this issue Sep 11, 2023
- fix tuple passed directly as argument to method (was broken in jdk 11+)
@rsmckinney rsmckinney added the bug label Sep 11, 2023
@rsmckinney
Copy link
Member

Fix available with release 2023.1.24

@CC007
Copy link
Contributor Author

CC007 commented Sep 12, 2023

Verified fixed

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

No branches or pull requests

2 participants