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 101834 - facade generation gives code that not compile due to keywords
Summary: facade generation gives code that not compile due to keywords
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: Dongmei Cao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-19 20:47 UTC by kretes
Modified: 2009-11-02 11:15 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
dump file requested in the error message (4.12 KB, text/plain)
2008-10-09 11:16 UTC, kretes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kretes 2007-04-19 20:47:02 UTC
Having  Entity class named 'Package' and generating facade i get someMethods
with arguments ( Package package ) which is not a correct java code, as
'package' is keyword!
Not checked with other keywords
Comment 1 Dongmei Cao 2008-10-08 00:12:02 UTC
We can add some more validation on the package name in the wizard
Comment 2 kretes 2008-10-09 11:13:32 UTC
the same is for other keywords & reserved words when this is the name of entity ( and it is probable that you hava a
Package or Class entity.. ).

For Class - there are even harder errors, because the code generation gives:

Annotation: An error occurred during parsing of
'E:\dokumenty\NetBeansProjects\EnterpriseApplication1\EnterpriseApplication1-ejb\src\java\org\bartczak\facade\ClassFacade.java'.
Please report a bug against java/source and attach dump file 'C:\Documents and
Settings\Tomek\.netbeans\dev\var\log\ClassFacade_3.dump'.
Annotation: An error occurred during parsing of
'E:\dokumenty\NetBeansProjects\EnterpriseApplication1\EnterpriseApplication1-ejb\src\java\org\bartczak\facade\ClassFacade.java'.
Please report a bug against java/source and attach dump file 'C:\Documents and
Settings\Tomek\.netbeans\dev\var\log\ClassFacade_3.dump'.
An error occurred during parsing of
'E:\dokumenty\NetBeansProjects\EnterpriseApplication1\EnterpriseApplication1-ejb\src\java\org\bartczak\facade\ClassFacade.java'.
Please report a bug against java/source and attach dump file 'C:\Documents and
Settings\Tomek\.netbeans\dev\var\log\ClassFacade_3.dump'.
An error occurred during parsing of
'E:\dokumenty\NetBeansProjects\EnterpriseApplication1\EnterpriseApplication1-ejb\src\java\org\bartczak\facade\ClassFacade.java'.
Please report a bug against java/source and attach dump file 'C:\Documents and
Settings\Tomek\.netbeans\dev\var\log\ClassFacade_3.dump'.
Caused: java.lang.NullPointerException
	at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:574)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:499)
	at com.sun.tools.javac.comp.Flow.scanDef(Flow.java:485)
	at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:632)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:499)
	at com.sun.tools.javac.comp.Flow.scanDef(Flow.java:485)
	at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:632)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:1300)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1131)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1094)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:445)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:425)
	at org.netbeans.api.java.source.JavaSource.moveToPhase(JavaSource.java:1367)
	at org.netbeans.api.java.source.JavaSource$CompilationJob.run(JavaSource.java:1710)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
[catch] at java.lang.Thread.run(Thread.java:595)

when generating and when opening the facade class, and rest of generation is stopped.

the generated facade class looks like this:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.bartczak.facade;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.bartczak.model.Class;

/**
 *
 * @author Tomek
 */
@Stateless
public class ClassFacade {
    @PersistenceContext
    private EntityManager em;

    public void create(Class class) {
        em.persist((ERROR));

        class <error> {
        }
    }

    public void edit(Class class) {
        em.merge((ERROR));

        class <error> {
        }
    }

}

This may be treated as another issue, because the editor id throwing NPE for *some* code - and it shouldn't never I assume.

Comment 3 kretes 2008-10-09 11:16:36 UTC
Created attachment 71447 [details]
dump file requested in the error message
Comment 4 Dongmei Cao 2008-11-19 21:47:42 UTC
low priority
Comment 5 Quality Engineering 2009-11-02 11:15:37 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX