Project: JDT
Bug 170197 [model] JavaCore.newLibraryEntry(.., IClasspathAttribute[], ..) should check for null
Reported: 2007-01-11 05:53:16 | Status: verified fixed

I20070109-1805 JavaCore.newLibraryEntry(.., IClasspathAttribute[], ..) should throw an exception if the given IClasspathAttribute[] is not null. Currently, null is silently accepted and leads to NPEs when the extra attributes are accessed later. Although unspecified, passing null for accessRules is currently accepted (and explicitly handled). Therefore, it's maybe better to continue allowing null for accessRules. Even jdt.core code currently relies on this behavior, see ClasspathEntry.decodeAccessRules(NodeList). I just fixed a broken invocation in our class BuildPathSupport, but such problems may be hard to find in general since creation and usage are quite separated.

Files changed in fix:
org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java