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 - Cannot infer type arguments for [...] even if type argument is specified.
Summary: Cannot infer type arguments for [...] even if type argument is specified.
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 7.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
Depends on:
Blocks: 192718
  Show dependency tree
 
Reported: 2010-11-18 23:32 UTC by converginglight
Modified: 2010-11-30 22:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Editor screenshot (51.08 KB, image/png)
2010-11-18 23:32 UTC, converginglight
Details

Note You need to log in before you can comment on or make changes to this bug.
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.