Hello again Sapphire developers,
After a several month hiatus I've back to working on sapphire editors again! We are about to roll out a new sapphire based editor and just doing some final QA and noticed a strange issue with @JavaType create class action.
First here is my build env: 0.3.x stream, buildId: 0.3.1.201109221708
Here is my element that represents a listener element:
@GenerateImpl
public interface IListener extends IModelElement, IDescribeable, IDisplayable {
ModelElementType TYPE = new ModelElementType( IListener.class );
// *** Implementation ***
@Type( base = JavaTypeName.class )
@Reference( target = JavaType.class )
@JavaTypeConstraint( kind = JavaTypeKind.CLASS, type = "javax.servlet.ServletContextListener" )
@Label( standard = "Implementation", full = "Listener implementation class" )
@Required
@XmlBinding( path = "listener-class" )
@Documentation( content = "The listener implementation class." )
ValueProperty PROP_IMPLEMENTATION = new ValueProperty( TYPE, "Implementation" );
ReferenceValue<JavaTypeName, JavaType> getImplementation();
void setImplementation( String value );
void setImplementation( JavaTypeName value );
}
So this type of model when a property editor is added for the Implementation property is where I'm having the problem. In the editor when I type in a implementation class name and if it doesn't exist, then I click on the "+" button for create, the file that is created is invalid. Here is the output in my particular case:
package com.test;
import javax.servlet.ServletContextEvent;
public class Foo
public FooListener() {
super();
// TODO Auto-generated constructor stub
}Listener implements ServletContextListener
{
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
}
As you can see the code is malformed and will not compile. What is strange is that if I go back to the @JavaTypeConstraint(..) annotation and specify another type ="" attribute and use a Class instead of an Interface the "+" create action works as expected. Also if instead use two interface classes instead of one that also works properly. But when I use just one interface class I get this error.
Is this a known issue?
--
Greg Amerson
Liferay, Inc.