Community
Participate
Working Groups
The following program should not compile. The assignment should fail with an error message like "Inconvertible types. Found X.Bar<capture of ?>, required X.Bar<capture of ?>." class X { public static void main(String[] args) { Foo<?> f1 = new Foo<Integer>(); f1.bar = f1.bar; } static class Foo<T> { Bar<T> bar = new Bar<T>(); } static class Bar<T> { T t; } }
Created attachment 18084 [details] Proposed patch I ran the JCK and had 27 failures. None appeared related to my bug. I ran the org.eclipse.jdt.core.tests.compiler test suite. There were numerous spurious differences due to textual changes from "?" to "capture of ?". I believe all failures are now either correct with the patch (ie, a false failure), pre-existing, or spurious.
Thank you much. Will look into integrating it soon. BTW, which version is this based upon ? Would you also contribute some JUnit tests demonstrating its improved behavior ?
Is there some easy way of turning the compiler output into the expected text for the diagnostic message? The commandline compiler seems to format the output slightly differently than when running through JUnit. I can't seem to get my test to pass. It's complaining about diffs in what I can only assume is whitespace. The patch is based on a sync to the head revision about two weeks ago.
Created attachment 18107 [details] New tests for patch I've added a two tests in GenericTypeTests.
You probably figured it out, but I will explain anyway... Usually you write the test, without filling the expected output. You run it, and then it fails and dumps in console what it did expect to obtain. You can then simply cut&paste back into the testcase after checking it is ok.
Added GenericTypeTest#test488-489
Added attached tests as GenericTypeTest#test581-582.
*** Bug 91017 has been marked as a duplicate of this bug. ***
Created attachment 20088 [details] Individual patch for DOM AST ITypeBinding (apply to DOM AST ITypeBinding unit) This patch previews the API change near capture binding introduction. Though captures are usually presented as synthetic type variables, the patch rather separates them into a new kind of binding which answers true only to #isCapture() and can provide access to the captured wildcard binding. It allows clients to take advantage of original wildcard.
Requesting PMC approval to release this API change for 3.1 inclusion. Patch to Signature will follow shortly.
Created attachment 20089 [details] Individual patch for model Signature (apply to org.eclipse.jdt.core.Signature unit) This patch previews the API change near capture signature introduction. Though captures are usually presented as synthetic type variables, the patch rather separates them into a new kind of signature. A capture of a wildcard has a signature prefixed with the '!' character, in a similar fashion to array signature (where prefix character is '['). Note that capture signature cannot occur in classfile, but may be revealed by certain APIs (through DOM AST binding, or selected element...).
Created attachment 20118 [details] Individual patch for DOM AST ITypeBinding I've made a number of minor improvements to the specs, and spec'd captures as having no names.
Created attachment 20121 [details] Individual patch for DOM AST ITypeBinding This is the correct patch file.
Created attachment 20124 [details] Individual patch for model Signature Minor improvements to spec.
Changes got released to HEAD.
Verified in I20050510-0010