Skip to content

Build manager incorrectly reports errors against Java inner classes #3133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scabug opened this issue Mar 2, 2010 · 8 comments
Closed

Build manager incorrectly reports errors against Java inner classes #3133

scabug opened this issue Mar 2, 2010 · 8 comments
Assignees
Labels

Comments

@scabug
Copy link

scabug commented Mar 2, 2010

In an upgrade to 2.8.0, I noticed a bunch of errors where references to inner classes triggered errors -- despite being legal Java, despite not causing problems in an ant build using 2.8.0prebeta1. Here is a small example, attached as a zip file of a small project (three Java files in a Scala project) demonstrating (I hope) how this goes wrong.

The offending file/line is GHashMap.java, line 104, with the reference to !WrappedKey "not found". !WrappedKey is defined on line 38 (and F3 will take you there!). Notice other mentions of !WrappedKey that do not cause problems to be reported. Qualifying it explicitly did not help, at least for me.

Everything involved is up-to-date as of earlier today, March 2.

This is the most boring code I could find that would exhibit this problem. It does not seem to be directly referenced from any Scala code in the larger project from which it was extracted.

@scabug
Copy link
Author

scabug commented Mar 2, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3133?orig=1
Reporter: David Chase (dr2chase)
Attachments:

@scabug
Copy link
Author

scabug commented Mar 2, 2010

David Chase (dr2chase) said:
zip of Eclipse project "Bug". Except for .scala_dependencies, should be position-independent. Regarding Sun Copyrights -- it's part of a BSD-licensed project, and derived from C code that I personally wrote in 1986 anyway.

@scabug
Copy link
Author

scabug commented Mar 2, 2010

@milessabin said:
Thanks for the test case.

I can confirm that no errors are reported (correctly) which command line scalac is invoked on it in the usual mode.

However when scalac is invoked with -Ybuilder-debug:refined specified (which replicates the behaviour of incremental builds in Eclipse) the (incorrect) error in the description is reported.

So it looks like a build manager issue to me ...

@scabug
Copy link
Author

scabug commented Mar 3, 2010

Sam Reid (samreid) said:
I'm seeing the same problem in my project with:
Eclipse Version: 3.5.2, Build id: M20100211-1343
Scala Eclipse Plugin 2.8.0.r21046-b20100303040037

Here's a more minimal error case (place in package test):

package test;

public class Test {
	public static interface TestInterface{}
	public Test(TestInterface ti){}
}

Note that if the constructor arg type is changed to Test.TestInterface, then the build completes properly.

@scabug
Copy link
Author

scabug commented Mar 3, 2010

David Chase (dr2chase) said:
I tried that fix in my example, I get (cut/paste from Eclipse)

Description	Resource	Path	Location	Type
type WrappedKey is not a member of object GHashMap	GHashMap.java	/Bug/src	line 104	Scala Problem

where the line in question reads

        this(hasher, new HashMap<WrappedKey, V>());

So your revised example, strictly speaking, is too minimal.

@scabug
Copy link
Author

scabug commented Mar 3, 2010

David Chase (dr2chase) said:
Scratch that previous "line in question", I copy/pasted the wrong one. THIS line:

    private GHashMap(Hasher<K> hasher, HashMap<GHashMap.WrappedKey, V> map) {

I've tinkered with adding type parameters to GHashMap, no luck.

@scabug
Copy link
Author

scabug commented Mar 3, 2010

David Chase (dr2chase) said:
FYI, here's the workaround that works for me:

    private GHashMap(Hasher<K> hasher, HashMap map) {
        this.hasher = hasher;
        this.map = (HashMap<GHashMap.WrappedKey, V>) map;
    }

(Yuck.)

@scabug
Copy link
Author

scabug commented Mar 17, 2010

@hubertp said:
(In r21207) Closes #3133. Review by community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants