Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » compiler bug with extension and generics?
compiler bug with extension and generics? [message #856174] Wed, 25 April 2012 12:43 Go to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 3
Registered: June 2010
Junior Member
I'm getting lines flagged as red with the following test case, but the project compiles. It fails when the following top level classes are defined:

SomeInterface.java:
public interface SomeInterface<R> {
    R someMethod();
}


SomeAbstractClass.java:
public abstract class SomeAbstractClass<R> {
    public abstract void someMethod2(final SomeInterface<R> cb);
}


SomeExtendingClass.java:
public class SomeExtendingClass extends SomeAbstractClass<byte[]> {
    @Override
    public void someMethod2(final SomeInterface<byte[]> cb) {

    }
}


What happens is:

1) The class SomeExtendingClass is marked with a red line and hovering over it says:

The type SomeExtendingClass must implement the inherited abstract method SomeAbstractClass<byte[]>.someMethod2(SomeInterface)

2) The method someMethod2 is marked with a red line and hovering over it says:

Name clash: The method someMethod2(SomeInterface<byte[]>) of type SomeExtendingClass has the same erasure as someMethod2(SomeInterface) of type SomeAbstractClass<R> but does not override it

Notes:

- It doesn't seem to prevent the project from compiling, and the errors do not show up in "Markers".

- Compiling these three files from the command line with javac succeeds.

- If these three classes are placed inside an enclosing class as inner classes, rather than top-level classes, it doesn't happen, i.e. this succeeds:

public final class ErasureTest {

    public interface SomeInnerInterface<R> {
	R someMethod3();
    }

    public abstract class SomeInnerAbstractClass<T> {
	public abstract void someMethod4(final SomeInnerInterface<T> cb);
    }

    public class SomeInnerExtendingClass extends SomeInnerAbstractClass<byte[]> {
	@Override
	public void someMethod4(final SomeInnerInterface<byte[]> cb) {

	}
    }

}



Configuration:

I'm running Eclipse Indigo SR2 (20120216-1857) on OS/X Lion with the default Mac JRE system library (1.6.0_31-b04-415-11M3635).

Before I post this as an Eclipse bug, am I missing something?

[Updated on: Wed, 25 April 2012 12:46]

Report message to a moderator

Re: compiler bug with extension and generics? [message #857391 is a reply to message #856174] Thu, 26 April 2012 13:51 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
I am not able to reproduce the problem.
- Are there any errors in the problems view?
- Are you able to reproduce this problem consistently?
- Do you get this error even when you extract into a sample project?
- Are there any 1.4 java projects in your workspace?
We did see these kind of errors before. We think we had fixed them, but depending upon these answers we can see if this is a different issue.
Re: compiler bug with extension and generics? [message #857523 is a reply to message #857391] Thu, 26 April 2012 16:08 Go to previous message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 3
Registered: June 2010
Junior Member
Thanks Satyam, replies below...

- Are there any errors in the problems view?

There are no errors in the problems view, only the highlighting on the code.

- Are you able to reproduce this problem consistently?

Consistently in my main project, see below...

- Do you get this error even when you extract into a sample project?

When I create these three files in a sample Java project, it doesn't happen. I see the difference now. This happens only when you create a new Google Web Application project (GWT) using the Google GWT plugin. I don't see why that should make a difference, but clearly it does.

- Are there any 1.4 java projects in your workspace?

No, but I believe the fact that this is a GWT project is the main issue. I suppose then it's best to pursue it with that team...
Previous Topic:Is there a way to quickly switch to a class file in Eclipse editor?
Next Topic:animation example problem
Goto Forum:
  


Current Time: Wed Nov 26 16:48:34 GMT 2014

Powered by FUDForum. Page generated in 0.02685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software