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.

Bug 192146

Summary: Cannot infer type arguments for [...] even if type argument is specified.
Product: java Reporter: converginglight
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED    
Severity: normal Keywords: REGRESSION
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 192718    
Attachments: Editor screenshot

Description converginglight 2010-11-18 23:32:23 UTC
Created attachment 103087 [details]
Editor screenshot

The following applies to NB 7 beta.

Consider the given code example.

It works with javac from JDK7 b118, but fails when compiling from NB (even if platform and binary compatibility are set to JDK7, and platform path really points to JDK7 b118).

NOTE 1: It is probable related to a javac bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6996914
This bug does NOT apply here, but seems to me very similar.

NOTE 2: The error is also displayed in the NB editor. Should it be a separated bug report for the editor?

NOTE 3: I made it P2 because an error is displayed+compiled where none exists.

= = = = = = = = = =
CODE
= = = = = = = = = =

import java.nio.file.*;
import java.util.concurrent.*;

public class _NBFormattingRegression2 {

	static abstract class MyCallable<V>
			implements Callable<V> {
	}

	public static void main(String... args) {
		// WORKS
		Callable<String> c = new MyCallable<String>() {

			@Override
			public String call() {
				return null;
			}

		};

		// ERROR: cannot infer type arguments for SimpleFileVisitor<>
		FileVisitor<Path> fv = new SimpleFileVisitor<Path>() {
		};
	}

}
Comment 1 Dusan Balek 2010-11-23 10:35:59 UTC
Should be fixed in current dev build.
See http://hg.netbeans.org/main-silver?cmd=changeset;node=1bbdf313ff1b
Comment 2 converginglight 2010-11-25 13:00:45 UTC
Well, the bug is still there in NB 2010-11-25.

Do I have to wait till the mentioned javac bug is fixed?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6996914

(The bug is marked with b120, currently released is b119)
Comment 3 Dusan Balek 2010-11-25 14:27:03 UTC
OOPS - source level should be set to 1.7 and the 'Can Use Diamond' hint has to be enabled to reproduce.
Comment 5 Quality Engineering 2010-11-27 06:28:10 UTC
Integrated into 'main-golden', will be available in build *201011270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ba752122555f
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #192146: Cannot infer type arguments for [...] even if type argument is specified - fixed.