NPE in Type.UndetVar.debugString()

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Sep 18 08:40:58 UTC 2017


Hi,
isn't this a bug in 10? Shouldn't this mail belong to compiler-dev?

Maurizio


On 16/09/17 14:54, B. Blaser wrote:
> Hi,
>
> When working on [1], I saw that "Type.UndetVar.debugString()"
> sometimes throws a NPE when called from within "UndetVar", for example
> in "addBound()" as here under, which is annoying...
>
> Could someone eventually push the following harmless fix to the amber
> and jdk10 repositories?
>
> This might be really helpful when debugging...
>
> Thanks,
> Bernard
>
> [1] http://mail.openjdk.java.net/pipermail/amber-dev/2017-September/002061.html
>
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
> b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
> @@ -1974,7 +1974,7 @@
>               }
>               for (InferenceBound bound: InferenceBound.values()) {
>                   List<Type> aboundList = bounds.get(bound);
> -                if (aboundList.size() > 0) {
> +                if (aboundList != null && aboundList.size() > 0) {
>                       result += bound + " = " + aboundList + '\n';
>                   }
>               }
> @@ -2112,6 +2112,7 @@
>                   bounds.put(ib, prevBounds.prepend(bound2));
>                   notifyBoundChange(ib, bound2, false);
>               }
> +//System.err.println("debug: " + debugString());
>           }
>           //where
>               TypeMapping<Void> toTypeVarMap = new
> StructuralTypeMapping<Void>() {



More information about the amber-dev mailing list