This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Sintax error: CriteriaBuilder, no suitable method found | ||
---|---|---|---|
Product: | java | Reporter: | FiruzzZ |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | normal | CC: | coladict, ender01 |
Priority: | P3 | ||
Version: | 8.2 | ||
Hardware: | PC | ||
OS: | Windows 10 x64 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | IDE log |
Description
FiruzzZ
2016-10-13 13:57:00 UTC
Created attachment 162493 [details]
IDE log
Experienced the same issue with following: Product Version: NetBeans IDE 8.2 (Build 201609300101) Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14 Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14 System: Mac OS X version 10.11.6 running on x86_64; UTF-8; en_US (nb) Projects are all Maven based, with spring-boot/hibernate defaults. This is also a fresh install (as of 11-1-2016). same issue for me as well, the error mark dissapapers if i seperate the expression like : Predicate p1=cb.equal(root.get(PresupuestoDiscapacidad_.cliente), cliente); Predicate p2=cb.equal... Predicate p3=cb.equal... Predicate p4=cb.equal... cq.where(cb.and(p1,p2,p3,p4)) Another way to reproduce: import java.util.Collections; import com.google.common.collect.ImmutableList; private class A{ public void setMinVal(int val1, int val2){ setVal(Collections.min(ImmutableList.of(val1, val2))); // error setVal(Collections.<Integer>min(ImmutableList.of(val1, val2))); } private void setVal(int i){} } Error: no suitable method found for min(ImmutableList<Integer>) method Collections.<T#1>min(Collection<? extends T#1>) is not applicable (inference variable E has incompatible bounds upper bounds: Comparable<? super T#1>,Object lower bounds: Integer) method Collections.<T#2>min(Collection<? extends T#2>,Comparator<? super T#2>) is not applicable (cannot infer type-variable(s) T#2 (actual and formal argument lists differ in length)) where T#1,E,T#2 are type-variables: T#1 extends Object,Comparable<? super T#1> declared in method <T#1>min(Collection<? extends T#1>) E extends Object declared in method <E>of(E,E) T#2 extends Object declared in method <T#2>min(Collection<? extends T#2>,Comparator<? super T#2>) This is a javac error, and it's IMHO intentional. Note that NetBeans 8.2 bundles half-baked JDK9 compiler, so if NB produces an error the official JDK8 does not, JDK9 is very likely to report the same error. I suggest to follow advices in the linked discussion or the javadoc page linked in from there (http://docs.oracle.com/javaee/6/api/javax/persistence/criteria/Path.html#get%28java.lang.String%29) and use parametrized method call to supply the ncessary types. Lowering the priority, moving to the correct component. IMHO it is a WONTFIX/INVALID It is most certainly NOT INVALID. This bug was introduced in 8.2 when it wasn't there in 8.1. When the IDE tells people there's an ambiguous error, they will try to fix it in and probably waste a lot of time trying to do so, without trying to compile, because they don't expect it to work. The tools are supposed to help our work, not hinder it. As other examples have shown, this is not limited to the JPA scenarios where you can work around it by using parametrized queries. I can also reproduce the bug on ubuntu 16.4 with OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11), NetBeans IDE 8.2 (Build 201609300101). I also agree that while functionally seemingly harmless, this bug is highly confusing. |