Bug 83611 - compiler reports error but there is no error
Summary: compiler reports error but there is no error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 critical with 1 vote (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-25 09:27 EST by Bartosz Jankiewicz CLA
Modified: 2005-02-16 07:19 EST (History)
0 users

See Also:


Attachments
complete test case (4.86 KB, application/zip)
2005-02-02 09:41 EST, Bartosz Jankiewicz CLA
no flags Details
extended test case (4.24 KB, application/zip)
2005-02-03 05:13 EST, Bartosz Jankiewicz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Jankiewicz CLA 2005-01-25 09:27:28 EST
Eclipse compiler reports error "The constructor [...] is undefined", where there
is the constructor's name in the place of [...]. Program compiles perfectly with
Sun's JDK 1.5. What is more, the error is not reported after cleaning and
building whole project. Program also starts after clean & build. The
constructors TypedInput<T>( Class<T>) and TypedOutput<T>( Class<T>) are defined
in internal class as shown below. Eclipse's internal compiler reports 2 errors
in the method void test() complaing that constructor is undefined.

public class Processor 
{
	public static class Contract extends InputClass
	{
		int getInputIndex() { return 0; }
		
		boolean isRequired() { return true; }
		
		public int getNumber() {	return getInt( 0); }
		public Date getDate() { return getDate( 1); }
		public double getValue() { return getDouble( 2); }
	}

	public static class State extends OutputClass
	{
		int getOutputIndex() { return 0; }
		
		public void setNumber( int nr) { setInt( 0, nr);}
		public void setDate( Date data) { setDate( 1, data);}
		public void setValue( double stan) { setDouble( 2, stan);} 
		public void setDelay( int opoznienie) { setInt( 3, opoznienie);}
	}
	
	
	public class TypedInput< T extends InputClass>
	{
		T templateObject;
		T currentObject;
		boolean endOfData = false;
		
		TypedInput( Class<T> templateClass) throws InstantiationException,
IllegalAccessException, InterruptedException, CloneNotSupportedException
		{
			this.templateObject = templateClass.newInstance();
		}
		
		void advance()
		{
			//doing something
		}
		
		boolean isEndOfData()
		{
			return this.endOfData;
		}
		
		T getCurrent()
		{
			return this.currentObject;
		}
	}
	
	class TypedOutput< T extends OutputClass>
	{
		private T templateObject;
		
		public TypedOutput( Class<T> templateClass) throws InstantiationException,
IllegalAccessException
		{
			templateObject = templateClass.newInstance();
		}
		
		void write( T outputObject) throws InterruptedException
		{
		}
	}

	public void test()
	{
		TypedInput<Contract> dateInput = new TypedInput<Contract>( Contract.class);
		TypedOutput<State> stateOutout = new TypedOutput<State>( State.class);
		
	}

}
Comment 1 Kent Johnson CLA 2005-02-01 12:50:55 EST
Can you please provide us with the complete testcase so we don't have to guess 
at what the missing types look like.
Comment 2 Bartosz Jankiewicz CLA 2005-02-02 09:41:34 EST
Created attachment 17625 [details]
complete test case
Comment 3 Kent Johnson CLA 2005-02-02 14:29:19 EST
If I change the declaration of the method Processor.test() to:

public void test() throws IllegalAccessException, InstantiationException {
  ...
}

I get no errors at all.

Which build are you running?
Comment 4 Bartosz Jankiewicz CLA 2005-02-03 05:13:00 EST
Created attachment 17644 [details]
extended test case
Comment 5 Kent Johnson CLA 2005-02-03 11:42:00 EST
thanks for the testcase.

Added GenericType test493
Comment 6 Bartosz Jankiewicz CLA 2005-02-04 05:05:49 EST
(In reply to comment #5)
> thanks for the testcase.
> 
> Added GenericType test493

Excellent! I'm looking forward to the next milestone.
Comment 7 David Audel CLA 2005-02-16 07:19:16 EST
Verified in I20050215-2300