Java Code Examples for com.sun.codemodel.internal.JMod#STATIC

The following examples show how to use com.sun.codemodel.internal.JMod#STATIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeModelClassFactory.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 2
Source File: CodeModelClassFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 3
Source File: CodeModelClassFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 4
Source File: CodeModelClassFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 5
Source File: CodeModelClassFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 6
Source File: CodeModelClassFactory.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 7
Source File: CodeModelClassFactory.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
Example 8
Source File: CodeModelClassFactory.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}