langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
changeset 24069 dfb8f11542fc
parent 22440 d40c30326317
child 24219 e7dc661cafae
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue Apr 22 19:52:15 2014 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue Apr 22 17:07:54 2014 -0400
@@ -406,6 +406,11 @@
             return Position.NOPOS;
 
         switch(tree.getTag()) {
+            case PACKAGEDEF: {
+                JCPackageDecl pd = (JCPackageDecl)tree;
+                return pd.annotations.isEmpty() ? pd.pos :
+                       pd.annotations.head.pos;
+            }
             case APPLY:
                 return getStartPos(((JCMethodInvocation) tree).meth);
             case ASSIGN:
@@ -788,6 +793,8 @@
         switch (node.getTag()) {
         case TOPLEVEL:
             return ((JCCompilationUnit) node).packge;
+        case PACKAGEDEF:
+            return ((JCPackageDecl) node).packge;
         case CLASSDEF:
             return ((JCClassDecl) node).sym;
         case METHODDEF:
@@ -820,6 +827,7 @@
     public static boolean isDeclaration(JCTree node) {
         node = skipParens(node);
         switch (node.getTag()) {
+        case PACKAGEDEF:
         case CLASSDEF:
         case METHODDEF:
         case VARDEF: