Buggy code:
class PackageBinding implements IPackageBinding { private static final String [ ] NO_NAME_COMPONENTS = CharOperation . NO_STRINGS ; private static final String UNNAMED = Util . EMPTY_STRING ; private static final char PACKAGE_NAME_SEPARATOR = '.' ; private org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding ; private String name ; private BindingResolver resolver ; private String [ ] components ; PackageBinding ( org . eclipse . jdt . internal . compiler . lookup . PackageBinding binding , BindingResolver resolver ) { } public IAnnotationBinding [ ] getAnnotations ( ) { try { INameEnvironment nameEnvironment = this . binding . environment . nameEnvironment ; if ( ! ( nameEnvironment instanceof SearchableEnvironment ) ) return AnnotationBinding . NoAnnotations ; NameLookup nameLookup = ( ( SearchableEnvironment ) ( nameEnvironment ) ) . nameLookup ; if ( nameLookup == null ) return AnnotationBinding . NoAnnotations ; final String pkgName = getName ( ) ; IPackageFragment [ ] pkgs = nameLookup . findPackageFragments ( pkgName , false ) ; if ( pkgs == null ) return AnnotationBinding . NoAnnotations ; for ( int i = 0 , len = pkgs . length ; i < len ; i ++ ) { int fragType = pkgs [ i ] . getKind ( ) ; switch ( fragType ) { case IPackageFragmentRoot . K_SOURCE : String unitName = "package-info.java" ; ICompilationUnit unit = pkgs [ i ] . getCompilationUnit ( unitName ) ; <START_BUG> if ( unit != null ) { <END_BUG> ASTParser p = ASTParser . newParser ( AST . JLS3 ) ; p . setSource ( unit ) ; p . setResolveBindings ( true ) ; p . setUnitName ( unitName ) ; p . setFocalPosition ( 0 ) ; p . setKind ( ASTParser . K_COMPILATION_UNIT ) ; CompilationUnit domUnit = ( ( CompilationUnit ) ( p . createAST ( null ) ) ) ; PackageDeclaration pkgDecl = domUnit . getPackage ( ) ; if ( pkgDecl != null ) { List annos = pkgDecl . annotations ( ) ; if ( ( annos == null ) || ( annos . isEmpty ( ) ) ) return AnnotationBinding . NoAnnotations ; IAnnotationBinding [ ] result = new IAnnotationBinding [ annos . size ( ) ] ; int index = 0 ; for ( Iterator it = annos . iterator ( ) ; it . hasNext ( ) ; index ++ ) { result [ index ] = ( ( Annotation ) ( it . next ( ) ) ) . resolveAnnotationBinding ( ) ; if ( ( result [ index ] ) == null ) return AnnotationBinding . NoAnnotations ; } return result ; } } break ; case IPackageFragmentRoot . K_BINARY : NameEnvironmentAnswer answer = nameEnvironment . findType ( TypeConstants . PACKAGE_INFO_NAME , this . binding . compoundName ) ; if ( ( answer != null ) && ( answer . isBinaryType ( ) ) ) { IBinaryType type = answer . getBinaryType ( ) ; char [ ] [ ] [ ] missingTypeNames = type . getMissingTypeNames ( ) ; IBinaryAnnotation [ ] binaryAnnotations = type . getAnnotations ( ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] binaryInstances = BinaryTypeBinding . createAnnotations ( binaryAnnotations , this . binding . environment , missingTypeNames ) ; org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding [ ] allInstances = org . eclipse . jdt . internal . compiler . lookup . AnnotationBinding . addStandardAnnotations ( binaryInstances , type . getTagBits ( ) , this . binding . environment ) ; int total = allInstances . length ; IAnnotationBinding [ ] domInstances = new AnnotationBinding [ total ] ; for ( int a = 0 ; a < total ; a ++ ) { final IAnnotationBinding annotationInstance = this . resolver . getAnnotationInstance ( allInstances [ a ] ) ; if ( annotationInstance == null ) { return AnnotationBinding . NoAnnotations ; } domInstances [ a ] = annotationInstance ; } return domInstances ; } } } } catch ( JavaModelException e ) { return AnnotationBinding . NoAnnotations ; } return AnnotationBinding . NoAnnotations ; } public String getName ( ) { } public boolean isUnnamed ( ) { } public String [ ] getNameComponents ( ) { } public int getKind ( ) { } public int getModifiers ( ) { } public boolean isDeprecated ( ) { } public boolean isRecovered ( ) { } public boolean isSynthetic ( ) { } public IJavaElement getJavaElement ( ) { } public String getKey ( ) { } public boolean isEqualTo ( IBinding other ) { } private void computeNameAndComponents ( ) { } public String toString ( ) { } }

Fix:
if ( ( unit != null ) && ( unit . exists ( ) ) ) {