Nice TWiki > Dev > NiceCompiler > BadErrorMessages (r1.6) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Dev . { Changes | Index | Search | Go }
An overview of error messages that needs improvement.

To do

Unsatisfiable constraints

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]

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)

-- ArjanB

Recent improvements

We 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 assignment

Code:

  List<String> l = null;

Old message:

null might be null

New 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 synchronization

Code:

  ?String s0 = null;
  synchronized (s0) {};

Old message:

s0 might be null

New message:

Synchonization must be done on a non-null object.
s0 might be null.

-- DanielBonniot - 30 Apr 2003

Missing arguments in constructor call - no arguments provided

Code:

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 D

BrynKeller - 30 Apr 2003

Missing arguments in constructor call - at least one argument provided

Code:

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 D

BrynKeller - 30 Apr 2003

template

Code:


Old message:


New message:


Topic BadErrorMessages . { Edit | Attach | Ref-By | Printable | Diffs | r1.12 | > | r1.11 | > | r1.10 | More }
Revision r1.6 - 30 Apr 2003 - 18:21 GMT - BrynKeller
Parents: WebHome > NiceCompiler
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.