This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 193381 - [70cat] REGRESSION: getPackage() returns null in annotation processor
Summary: [70cat] REGRESSION: getPackage() returns null in annotation processor
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 7.0
Hardware: All All
: P1 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2010-12-14 14:56 UTC by misterm
Modified: 2010-12-15 15:46 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2010-12-14 14:56:50 UTC
In a Java project properly configured to use annotation processors, in NetBeans 6.9, using SomeClass.class.getPackage() returns a package instance. In 7.0, something has been changed since the call now returns null, causing a NPE to be thrown. This is a common technique employed by processor writers, such as the Hibernate Validator Annotation Processor.

The first two attachments to bug # 193379 contain a project that demonstrates the problem. The stack trace can be seen in the IDE log when the project is opened. The NPE is caused by a call to Size.class.getPackage().getName(). Size is contained in validation-api-1.0.0.GA.jar, which is part of the library. The processor works on 6.9.

Product Version = NetBeans IDE Dev (Build 101214-090a73ea0cba)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_19
Runtime = Java HotSpot(TM) Client VM 16.2-b04
Comment 1 Quality Engineering 2010-12-15 06:20:58 UTC
Integrated into 'main-golden', will be available in build *201012150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/07a40b1a784e
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #193381: when a class is defined, the corresponding package needs to be defined as well unless it is already defined.
Comment 2 Jan Lahoda 2010-12-15 08:19:14 UTC
Fixed by the above commit.