[jbosstools-dev] Problem with CDI Builder creating new 'A' type

Xavier Coulon xcoulon at redhat.com
Tue Jul 31 09:34:19 EDT 2012


Hello Daniel,

As I'm trying to fix https://issues.jboss.org/browse/JBIDE-12095, I found something a bit strange in the CDIBuilderDelegate when editing a 'package-info.java' file (just adding a space char):
At line 90, the CDIBuilderDelegate#build() method calls the PackageDelegate#setPackage() method below which creates a 'class A {}' as shown below.

	public void setPackage(IPackageDeclaration pkg, IRootDefinitionContext context) {
		qualifiedName = pkg.getElementName();
		IType contextType = null;
		ICompilationUnit u = null;
		if(pkg.getParent() instanceof ICompilationUnit) {
			try {
				u = ((ICompilationUnit)pkg.getParent()).getWorkingCopy(new NullProgressMonitor());
				contextType = u.createType("class A {}", null, false, new NullProgressMonitor());
			} catch (JavaModelException e) {
				
			}
		}
		super.setAnnotatable(pkg, contextType, context, 0);
		if (u != null) {
			try {
				u.discardWorkingCopy();
			} catch (JavaModelException e) {
				
			}
		}
	} 

The JAX-RS plugin catches an event for this type creation but fails later. I can add some tests to verify that the type really exist, but still, is this necessary (just asking, don't take is bad) ?

Thanks.
Best regards,
/Xavier



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20120731/1e511c14/attachment.html 


More information about the jbosstools-dev mailing list