Blocks :
|
|
Blocks :
|
|
Duplicate :
|
|
Relates :
|
This code: import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Stream; public class Bug1 { public static void main(String[] args) { new Bug1().test(); } public void test() { System.out.println(match( a -> true, (v) -> { if ("one".equals(v)) return 1; if (v instanceof Number) { Number n = (Number) v; if (n.longValue() == 3) return "three"; return n.longValue(); } return ""; }, 2, 3, "one", "two") ); } public <T> T match(Predicate<T> p, Function<T, T> f, T... t) { return Stream.of(t).parallel().filter(p).map(f).findAny().get(); } } provokes an assertion error: An exception has occurred in the compiler (1.9.0-internal). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.AssertionError: attribution shouldn't be happening here at com.sun.tools.javac.util.Assert.error(Assert.java:132) at com.sun.tools.javac.util.Assert.check(Assert.java:93) at com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:594) at com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:482) at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:198) at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:562) at com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:599) at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3760) at com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3548) at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3455) at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3434) at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3421) at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3159) at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2188) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1769) at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1599) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:389) at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:283) at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:249) at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:236) at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1002) at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:824) at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:729) at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:833) at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:574) at com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1436) at com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1623) at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1694) at com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1667) at com.sun.tools.javac.comp.Resolve$9.doLookup(Resolve.java:2375) at com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3031) at com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3282) at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2372) at com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2366) at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3330) at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3212) at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2070) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1769) at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1599) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:585) at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1537) at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1417) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:605) at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:621) at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1073) at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:985) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:605) at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:968) at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:837) at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:539) at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:605) at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4282) at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4192) at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4121) at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4096) at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1224) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:866) at com.sun.tools.javac.main.Main.compile(Main.java:249) at com.sun.tools.javac.main.Main.compile(Main.java:140) at com.sun.tools.javac.Main.compile(Main.java:56) at com.sun.tools.javac.Main.main(Main.java:42) reported by Alex Zuev
|