src/share/classes/com/sun/tools/javac/comp/Resolve.java

changeset 855
afe226180744
parent 853
875262e89b52
child 880
0c24826853b2
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 03 09:37:28 2011 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 03 09:38:19 2011 +0000
     1.3 @@ -1952,6 +1952,9 @@
     1.4                          key, name, first, second);
     1.5              }
     1.6              boolean hasLocation = false;
     1.7 +            if (location == null) {
     1.8 +                location = site.tsym;
     1.9 +            }
    1.10              if (!location.name.isEmpty()) {
    1.11                  if (location.kind == PCK && !site.tsym.exists()) {
    1.12                      return diags.create(dkind, log.currentSource(), pos,
    1.13 @@ -1969,7 +1972,7 @@
    1.14                  return diags.create(dkind, log.currentSource(), pos,
    1.15                          errKey, kindname, idname, //symbol kindname, name
    1.16                          typeargtypes, argtypes, //type parameters and arguments (if any)
    1.17 -                        getLocationDiag(location)); //location kindname, type
    1.18 +                        getLocationDiag(location, site)); //location kindname, type
    1.19              }
    1.20              else {
    1.21                  return diags.create(dkind, log.currentSource(), pos,
    1.22 @@ -1990,15 +1993,18 @@
    1.23              }
    1.24              return key + suffix;
    1.25          }
    1.26 -        private JCDiagnostic getLocationDiag(Symbol location) {
    1.27 -            boolean isVar = location.kind == VAR;
    1.28 -            String key = isVar ?
    1.29 -                "location.1" :
    1.30 -                "location";
    1.31 -            return diags.fragment(key,
    1.32 +        private JCDiagnostic getLocationDiag(Symbol location, Type site) {
    1.33 +            if (location.kind == VAR) {
    1.34 +                return diags.fragment("location.1",
    1.35                      kindName(location),
    1.36                      location,
    1.37 -                    isVar ? location.type : null);
    1.38 +                    location.type);
    1.39 +            } else {
    1.40 +                return diags.fragment("location",
    1.41 +                    typeKindName(site),
    1.42 +                    site,
    1.43 +                    null);
    1.44 +            }
    1.45          }
    1.46      }
    1.47  

mercurial