| <<O>> Difference Topic BadErrorMessages (r1.12 - 01 Feb 2004 - DanielBonniot) |
| Added: | |
| > > | This last form could be chosen as soon as the value assigned is "big". |
| <<O>> Difference Topic BadErrorMessages (r1.11 - 01 Feb 2004 - BrianSmith) |
| Added: | |
| > > |
Desugaring of ?: operatorIn general, it seems like desugared code should never be shown in error messages. Only show code fragments when necessary, and only show code that actually appears in the source files. Code:
class A { ?Integer n; }
void main(String [] args) {
let a2 = new A(n: new Integer(2));
Integer n2 = a2.n != null ? a2.n : new Integer(1);
}
Old message:
The value if(`!=`(a2.n(), null))
a2.n()
else
new Integer(1)
cannot be assigned to n2 because it might be null.
New message:
The value a2.n != null ? a2.n : new Integer(1)
cannot be assigned to n2 because it might be null.
or
Attempt to assign a possibly-null value to n2
|
| <<O>> Difference Topic BadErrorMessages (r1.10 - 06 May 2003 - ArjanB) |
| Added: | |
| > > | I just fixed the problem of these extreme long error messages. The parser has some difficulties with generating error messages in case of a lookahead. But I haven't a good idea yet how to improve the normal parse exception messages. -- ArjanB |
| <<O>> Difference Topic BadErrorMessages (r1.9 - 05 May 2003 - BrynKeller) |
| Added: | |
| > > | I just tested the compiler on the real-world code that inspired this example to see how long it would actually take to report the error - I gave up after 20 minutes. :-) |
| <<O>> Difference Topic BadErrorMessages (r1.8 - 05 May 2003 - BrynKeller) |
| Added: | |
| > > |
Here's a particularly awful example of this problem:
void main(String[] args)
{
String[] foo = [];
args.foreach(String s => {
if (true) {
foo = null;
} else {
foo = foo.concat(["bar"]) //Note missing semicolon.
}
});
}
This takes long enough to report a message that you're likely to think the compiler's gone into a loop, especially if it's in a real source file not just this tiny example. Finally, it produces more than 700 lines of parse alternatives, most of which look something like these:
<IDENT> "=>" "{" "if" "(" <IDENT> ")" "{" <IDENT> "=" "null" ";" ";" ...
<IDENT> "=>" "{" "if" "(" <IDENT> ")" "{" <IDENT> "=" "null" ";" "++" ...
<IDENT> "=>" "{" "if" "(" <IDENT> ")" "{" <IDENT> "=" "null" ";" "--" ...
<IDENT> "=>" "{" "if" "(" <IDENT> ")" "{" <IDENT> "=" "null" ";" "null" ...
-- BrynKeller - 05 May 2003 |
| <<O>> Difference Topic BadErrorMessages (r1.7 - 03 May 2003 - ArjanB) |
| Added: | |
| > > |
Useless parsing exceptionsSometime if you forget a ";" or a ")" or something else then you get a very long parse exception messages. It's not helpfull to get 20 lines of possible alternatives of wich half are multi-token alternatives. No good example at the moment. |
| <<O>> Difference Topic BadErrorMessages (r1.6 - 30 Apr 2003 - BrynKeller) |
| Added: | |
| > > |
Missing arguments in constructor call - no arguments providedCode:
class A {
String B;
String C = "test";
?String D;
}
void main(String[] args) {new A();}
Old message:
Class test.A has the following fields: java.lang.String B, java.lang.String C = "Test", ?java.lang.String D Please provide values for the fields, at least for those with no default value. The syntax is: new test.A(field1: value1, ..., fieldN: valueN)New message: Fields of class test.A require initial values. Use the following syntax: new test.A(B: value, D: value) Class test.Foo has the following fields: java.lang.String B java.lang.String C = "test" ?java.lang.String DBrynKeller - 30 Apr 2003 Missing arguments in constructor call - at least one argument providedCode:
class A {
String B;
String C = "test";
?String D;
}
void main(String[] args) {new A(B: "foo");}
Old message:
Class test.A has the following fields: java.lang.String B, java.lang.String C = "Test", ?java.lang.String D Please provide values for the fields, at least for those with no default value. The syntax is: new test.A(field1: value1, ..., fieldN: valueN)New message: Fields of class test.A require initial values. These fields are missing: ?java.lang.String DBrynKeller - 30 Apr 2003 |
| <<O>> Difference Topic BadErrorMessages (r1.5 - 30 Apr 2003 - DanielBonniot) |
| Changed: | |
| < < |
To do |
| > > |
To do |
| Changed: | |
| < < |
Unsatisfiable constraints |
| > > |
Unsatisfiable constraints |
| Changed: | |
| < < |
Too long message when calling a method with a wrong argument. |
| > > |
Too long message when calling a method with a wrong argument. |
| Changed: | |
| < < |
Recent improvements |
| > > |
Recent improvements |
| Changed: | |
| < < |
Null values in assignment |
| > > |
Null values in assignment |
| Changed: | |
| < < | Code: |
| > > | Code: |
| Changed: | |
| < < | Old message: |
| > > | Old message: |
| Changed: | |
| < < | New message: |
| > > | New message: |
| Changed: | |
| < < |
Null values in synchronization |
| > > |
Null values in synchronization |
| Changed: | |
| < < | Code: |
| > > | Code: |
| Changed: | |
| < < | Old message: |
| > > | Old message: |
| Changed: | |
| < < | New message: |
| > > | New message: |
| Changed: | |
| < < | Code: |
| > > | Code: |
| Changed: | |
| < < | Old message: |
| > > | Old message: |
| Changed: | |
| < < | New message: |
| > > | New message: |
| <<O>> Difference Topic BadErrorMessages (r1.4 - 30 Apr 2003 - DanielBonniot) |
| Added: | |
| > > | TOC: No TOC in "Dev.BadErrorMessages" |
| <<O>> Difference Topic BadErrorMessages (r1.3 - 30 Apr 2003 - ArjanB) |
| Changed: | |
| < < |
To do |
| > > |
To do |
| Added: | |
| > > |
Unsatisfiable constraints |
| Added: | |
| > > |
Too long message when calling a method with a wrong argument.?List<String> list = null; list.get(1); No possible call for get. Arguments: (?java.util.List<java.lang.String>, nice.lang.byte) Possibilities: nice.lang.int get(java.util.Calendar, nice.lang.int) java.lang.Object get(sun.reflect.FieldAccessor, ?java.lang.Object) <K, V> V get(java.util.Dictionary<K, V>, ?java.lang.Object) <E> E get(java.util.List<E>, nice.lang.int) nice.lang.char get(String s, int index) nice.lang.double get(nice.lang.Array<double>, int) nice.lang.float get(nice.lang.Array<float>, int) nice.lang.char get(nice.lang.Array<char>, int) nice.lang.long get(nice.lang.Array<long>, int) nice.lang.int get(nice.lang.Array<int>, int) nice.lang.short get(nice.lang.Array<short>, int) nice.lang.byte get(nice.lang.Array<byte>, int) nice.lang.boolean get(nice.lang.Array<boolean>, int) <Any T> T get(nice.lang.Array<T>, int) nice.lang.boolean get(int x, int bit) nice.lang.boolean get(long x, int bit) <Any K, Any K0, Any V0, Any V | K <: K0, V <: ?V0> ?V0 get(java.util.Map<K, V>, K0) <Any T, Any U> U get(Field, T) |
| Changed: | |
| < < |
Recent improvements |
| > > |
Recent improvements |
| Changed: | |
| < < |
Null values in assignment |
| > > |
Null values in assignment |
| Changed: | |
| < < |
Null values in synchronization |
| > > |
Null values in synchronization |
| <<O>> Difference Topic BadErrorMessages (r1.2 - 30 Apr 2003 - DanielBonniot) |
| Changed: | |
| < < |
|
| > > |
To do |
| Added: | |
| > > |
Recent improvementsWe can keep track of recent improvements. This way, there can be a debate about the change, if somebody doesn't like it, or thinks it could be further improved. Each entry should follow this format: code, old message, new message. To add an entry, you can copy paste the template at the bottom, and fill it in.Null values in assignmentCode:List<String> l = null;Old message: null might be nullNew message: The value null cannot be assigned to l because it might be null. To allow l to contain the null value, it should be declared as: ?java.util.List<java.lang.String> l-- DanielBonniot - 30 Apr 2003 Null values in synchronizationCode:
?String s0 = null;
synchronized (s0) {};
Old message:
s0 might be nullNew message: Synchonization must be done on a non-null object. s0 might be null.-- DanielBonniot - 30 Apr 2003 templateCode:Old message: New message: |
| <<O>> Difference Topic BadErrorMessages (r1.1 - 28 Apr 2003 - ArjanB) |
| Added: | |
| > > |
%META:TOPICINFO{author="ArjanB" date="1051570138" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="NiceCompiler"}%
An overview of errormessages that needs improvement.
class A{}
class B extends A{}
interface I<A T>{}
class X<T | A <: T> implements I<T>{}
void foo(I<B>);
foo(@X){}
Type error in method body "foo":
mlsub.typing.TypingEx: Not satisfiable [NO MESSAGE]
-- ArjanB |
| Topic BadErrorMessages . { View | Diffs | r1.12 | > | r1.11 | > | r1.10 | More } |
|
Revision r1.1 - 28 Apr 2003 - 22:48 GMT - ArjanB Revision r1.12 - 01 Feb 2004 - 20:23 GMT - DanielBonniot |
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding TWiki? Send feedback. |