Bug 14921 - No error message from inner type instantiation in static context
Summary: No error message from inner type instantiation in static context
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: Other other
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-30 11:18 EDT by Jared Burns CLA
Modified: 2002-04-30 21:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Burns CLA 2002-04-30 11:18:41 EDT
Build 20020425

The following code does not return any errors when we pass it into
AST.parseCompilationUnit(char[], String, IJavaProject). It should return an
error about the instantiation of an inner type without an inclosing instance of
Hello (as it does when this code is compiled in a java editor).

class Hello{
static void ___run(java.lang.String[] args) throws Throwable {
new Bar().toString();
}
 class Bar{
}
public static void main (String[] args){
}
}
Comment 1 Olivier Thomann CLA 2002-04-30 12:18:03 EDT
This error is reported by the compiler during the code generation. The AST conversion doesn't do a 
code generation. I think we have a misunderstanding on what is done during the conversion. There 
is no flow analysis, neither a code generation during the AST conversion. So all errors which are 
detected later in the compilation process (after the type checking) cannot be reported through 
the compilation unit getMessages() collection. I will discuss with Jim to find out if we are 
suppose to do so.
Comment 2 Olivier Thomann CLA 2002-04-30 12:51:23 EDT
getMessages() states that it returns the list of messages reported by the compiler during the 
parsing or name resolution of this compilation unit. I will change it to specify more clearly that 
this list might be a subset of the problems returned by the compiler when the corresponding source 
is compiled.
Comment 3 Jim des Rivieres CLA 2002-04-30 21:45:37 EDT
In summary, reporting this kind of error is outside the scope of the DOM/AST.
This is the kind of error that only a full Java compiler is ever going to
give you. If you need to detect this kind of error, your only serious
option is to invoke the Java compiler.

This bug report should be rejected.