Permalink
Browse files

fix some warnings and add properties.gradle fix some Error in feature…

…s set
  • Loading branch information...
Stefan Lindel
Stefan Lindel committed Sep 22, 2014
1 parent 415c843 commit 62f203683dd047a5b792d18cf6a6e0a854ce254f
View
@@ -14,7 +14,7 @@ task printVersion {
version = new GITVersion(major: majorNumber,minor: getGitTag(), revision: revisionNumber(), hash: revisionHash(), buildTime: buildTime() )
ext{
- gitVersion = new GITVersion(major: majorNumber,minor: getGitTag(), revision: revisionNumber(), hash: revisionHash(), buildTime: buildTime() )
+ gitVersion = new GITVersion(major: majorNumber,minor: getGitTag(), revision: revisionNumber(), hash: revisionHash(), buildTime: buildTime(), lecture: project.hasProperty('lectureBuild') )
}
group = 'org.sdmlib'
// Define a method using a closure as the method body
@@ -29,12 +29,14 @@ public class GITVersion {
// change, if release is needed some day: boolean release
// also change version above to accept release property
boolean release = false
+ boolean lecture
String toString() {
if (System.getenv().BUILD_NUMBER) {
revision = System.getenv().BUILD_NUMBER as int
}
- "$major.$minor.$revision${release ? '' : '-SNAPSHOT'}"
+
+ "$major.$minor.$revision${release ? '' : (lecture ? '-LECTURE' : '-SNAPSHOT')}"
}
}
View
@@ -0,0 +1 @@
+org.gradle.daemon = true
@@ -26,6 +26,7 @@ and associated documentation files (the "Software"), to deal in the Software wit
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
+import java.util.HashSet;
import java.util.Set;
import org.sdmlib.CGUtil;
@@ -241,6 +242,22 @@ public ClassModel withFeature(Feature... value)
}
return this;
}
+ public ClassModel withFeatures(HashSet<Feature> value)
+ {
+ if (value == null) {
+ this.features.clear();
+ return this;
+ }
+ for (Feature item : value) {
+ if (item != null) {
+ if (this.features.add(item)) {
+ getPropertyChangeSupport().firePropertyChange(
+ PROPERTY_FEATURE, null, item);
+ }
+ }
+ }
+ return this;
+ }
public boolean hasFeature(Feature value)
{
@@ -27,7 +27,6 @@ and associated documentation files (the "Software"), to deal in the Software wit
import org.sdmlib.models.classes.util.ArrayListSet;
import org.sdmlib.models.classes.util.EnumerationSet;
import org.sdmlib.models.classes.util.MethodSet;
-import java.util.TreeSet;
public class Enumeration extends SDMLibClass {
@@ -25,7 +25,6 @@ and associated documentation files (the "Software"), to deal in the Software wit
import org.sdmlib.StrUtil;
import org.sdmlib.serialization.PropertyChangeInterface;
-import java.beans.PropertyChangeListener;
public abstract class SDMLibClass implements PropertyChangeInterface
{
@@ -12,7 +12,6 @@
import org.sdmlib.models.classes.Enumeration;
import org.sdmlib.models.classes.Feature;
import org.sdmlib.models.classes.Visibility;
-import org.sdmlib.models.modelsets.booleanList;
import org.sdmlib.models.pattern.AttributeConstraint;
public class GenAttribute extends Generator<Attribute>
@@ -577,6 +577,9 @@ public void printFile()
public void printFile(Parser parser)
{
+ if(parser==null){
+ return;
+ }
if(!isShowDiff()){
CGUtil.printFile(parser);
}
@@ -291,7 +291,7 @@ public Parser getOrCreateCreatorCreatorParser(String rootDir)
"}\n");
StringBuilder creators = new StringBuilder();
- boolean publicCreatorCreator = false;
+// boolean publicCreatorCreator = false;
for (Clazz clazz : model.getClasses())
{
if (!clazz.isInterface() && !clazz.isEnumeration() && includeCreators(clazz))
@@ -318,7 +318,7 @@ public Parser getOrCreateCreatorCreatorParser(String rootDir)
// if there are multiple packages, the CreatorCreator must be public
if (!model.getName().equals(CGUtil.packageName(clazz.getFullName())))
{
- publicCreatorCreator = true;
+// publicCreatorCreator = true;
}
}
}
@@ -1277,10 +1277,10 @@ private boolean compareMethodDecl(Method method, LocalVarTableEntry localVarTabl
{
String shortClassName = CGUtil.shortClassName(method.getClazz().getFullName());
- String signature = method.getSignature(true);
+// String signature = method.getSignature(true);
- String methodClass = "";
- String methodSignature = "";
+// String methodClass = "";
+// String methodSignature = "";
ArrayList<ArrayList<String>> initSequence = localVarTableEntry.getInitSequence();
// the first method call should be model.createClazz(<className>)
@@ -1313,7 +1313,7 @@ private boolean compareMethodDecl(Method method, LocalVarTableEntry localVarTabl
if ( ! dataType.equals(searchType)) return false;
- boolean found = false;
+// boolean found = false;
try {
int j = 6;
Iterator<Parameter> paramIter = method.getParameter().iterator();
@@ -1364,7 +1364,7 @@ private boolean compareMethodDecl(Method method, LocalVarTableEntry localVarTabl
return false;
}
- private String parseDataType(String typeString, Clazz modelCreationClass) {
+ protected String parseDataType(String typeString, Clazz modelCreationClass) {
String type = "";
@@ -743,8 +743,10 @@ public void generate(Clazz clazz, String rootDir, String helperDir, Role partner
// generate property in model set class
Parser modelSetParser = getGenerator(clazz).getOrCreateParserForModelSetFile(helperDir);
- insertGetterInModelSetFile(clazz, modelSetParser, myParser, partnerRole);
- insertSetterInModelSetFile(clazz, modelSetParser, partnerRole);
+ if(getModel().getClazz().getClassModel().hasFeature(Feature.PatternObject)){
+ insertGetterInModelSetFile(clazz, modelSetParser, myParser, partnerRole);
+ insertSetterInModelSetFile(clazz, modelSetParser, partnerRole);
+ }
getGenerator(clazz).printFile(modelSetParser);

0 comments on commit 62f2036

Please sign in to comment.