Bug 499326 - [compiler] error reporting depends on order of compilation units
Summary: [compiler] error reporting depends on order of compilation units
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-08-07 09:05 EDT by Stephan Herrmann CLA
Modified: 2022-12-12 11:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2016-08-07 09:05:18 EDT
Observable in a workspace with the examples from NullTypeAnnotationTest.testBug497698():

//---
package test;

import org.eclipse.jdt.annotation.NonNullByDefault;

@NonNullByDefault
public class And {
	public static void createAnd() {
		Or.create();
	}
}
//---
package test;

import org.eclipse.jdt.annotation.NonNullByDefault;

@NonNullByDefault
public class Or<D, V> {
	public static <V> Or<V> create() {
		return new Or<V, V>(); 
	}
}
//---


1. Full build:
  -> 1 Error against return type of Or.create() => OK
2. Edit and save Or.java
  -> Additional Error appears against And.java:
   "The method create() is undefined for the type Or"

If resolveTypesFor() is triggered by methods() (2) we recognize the return problem and drop this method from STB#methods.

If, OTOH, resolveTypesFor() is first triggered by getMethods(char[]) (1), we call methods() in a state where the type reference is already resolved (to the unparameterized STB), thus hiding the return problem -> we keep the method and no error is reported at the call site.

To demonstrate that this is not an issue of compiler vs. reconciler simply batch-compile both classes 

1.
ecj -classpath path-to-o.e.j.annotation.jar test/And.java test/Or.java
-> 1 error

2.
ecj -classpath path-to-o.e.j.annotation.jar test/Or.java test/And.java
-> 2 errors
Comment 1 Manoj N Palat CLA 2018-05-17 03:24:22 EDT
bulk move out of 4.8
Comment 2 Manoj N Palat CLA 2018-08-16 00:07:26 EDT
Bulk move out of 4.9
Comment 3 Eclipse Genie CLA 2022-12-12 11:53:16 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.