Open JrmyDev opened 9 years ago
I asked for this because when I try to "clean and build" my project I have this error :
In Mirah Precompile for CN1 Project
Deleting directory /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah
Created dir: /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah_tmp/macros/src
Created dir: /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah_tmp/macros/classes
Setting macro classpath to /Users/jmarquer/NetBeansProjects/Survey4iPad/lib/mirah/macros/CN1MirahJSON-macros.jar
Failed to generate signature for type List
Hmm. Can you post the Dossier class so I can see what's going on here? For some reason its having trouble with the class signature. On Jun 22, 2015 8:12 AM, "JrmyDev" notifications@github.com wrote:
I asked for this because when I try to "clean and build" my project I have this error : In Mirah Precompile for CN1 Project Deleting directory /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah Created dir: /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah_tmp/macros/src Created dir: /Users/jmarquer/NetBeansProjects/Survey4iPad/build/mirah_tmp/macros/classes Setting macro classpath to /Users/jmarquer/NetBeansProjects/Survey4iPad/lib/mirah/macros/CN1MirahJSON-macros.jar Failed to generate signature for type List Failed to generate signature for type Dossier /Users/jmarquer/NetBeansProjects/Survey4iPad/nbproject/mirah-build-cn1.xml:152:
java.lang.RuntimeException: Could not find class for Dossier at ca.weblite.asm.JavaExtendedStubCompiler$2.visitVariable(JavaExtendedStubCompiler.java:564) at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:864) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68) at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81) at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91) at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99) at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:133) at ca.weblite.asm.JavaExtendedStubCompiler$2.visitClass(JavaExtendedStubCompiler.java:768) at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:720) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68) at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91) at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99) at com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:120) at ca.weblite.asm.JavaExtendedStubCompiler$2.visitCompilationUnit(JavaExtendedStubCompiler.java:275) at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:550) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68) at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91) at ca.weblite.asm.JavaExtendedStubCompiler.compile(JavaExtendedStubCompiler.java:797) at ca.weblite.asm.JavaExtendedStubCompiler.compileFile(JavaExtendedStubCompiler.java:174) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:211) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:214) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:214) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:214) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:214) at ca.weblite.asm.JavaExtendedStubCompiler.compileDirectory(JavaExtendedStubCompiler.java:193) at ca.weblite.asm.WLMirahCompiler.compile(WLMirahCompiler.java:208) at ca.weblite.mirah.ant.MirahcTask.execute(MirahcTask.java:158) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) at org.apache.tools.ant.Project.executeTarget(Project.java:1364) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1248) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) BUILD FAILED (total time: 5 seconds)
— Reply to this email directly or view it on GitHub https://github.com/shannah/cn1-mirah-json-macros/issues/2#issuecomment-114147082 .
package com.amplitude.tablet.model;
import com.amplitude.tablet.util.Constant; import com.amplitude.tablet.util.NumberUtil; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.List;
/**
public class Dossier extends SynchronizableObject { private static final long serialVersionUID = 5151727623380113413L;
/**
*
*/
public final static String PARAMFORM_NOM_PATIENT = "_PARAMFORM";
private Patient patient;
private Long idPatient;
private User user;
private Long idUser;
private BilanPreOp bilanPreOp;
private Long idBilanPreOp;
private Intervention intervention;
private Long idIntervention;
private List<Examen> listExamen;
private Long numImplant;
private Boolean enable;
private String nom;
private Long idEtatDossier;
private Long idEtatPatient;
private Long idCompartiment;
private Long idCoteOp;
private Long idTypeOp;
private Date dateDernierControle;
private Integer numeroDernierControle;
private Date dateCloture;
private Integer recul;
private Etape[] etape = new Etape[30]; // pour indiquer aux jsp l'étape en cours
/**
*
*/
public static final int ePREOP = 0;
/**
*
*/
public static final int eC1 = 3;
// champ permettant de noter que le patient a été informé à propos de l'archivage informatique de ses données
private Boolean infoPatient;
// Sync data
private String syncState;
/**
*
*/
public Dossier() {
super();
// this.proprio = new User();
this.patient = new Patient();
this.bilanPreOp = new BilanPreOp();
this.intervention = new Intervention();
this.listExamen = new ArrayList<Examen>();
infoPatient=false;
}
// ***************** Get + Set ***********************//
/**
*
* @return
*/
public User getUser() {
return user;
}
/**
*
* @param value
*/
public void setUser(User user) {
this.user = user;
}
/**
*
* @return
*/
public Integer getEnableInt() {
if (getEnable())
return 1;
else
return 0;
}
// might not be used, but define a property
/**
*
* @param i
*/
public void setEnableInt(Integer i) {
setEnable(i != null && i == 1);
}
/**
*
* @return
*/
public Boolean getEnable() {
return enable;
}
/**
*
* @param value
*/
public void setEnable(Boolean value) {
this.enable = value;
}
/**
*
* @return
*/
public Long getNumImplant() {
return numImplant;
}
/**
*
* @param value
*/
public void setNumImplant(Long value) {
this.numImplant = value;
}
/**
*
* @return
*/
public Long getIdUser() {
return idUser;
}
/**
*
* @param value
*/
public void setIdUser(Long value) {
this.idUser = value;
}
/**
*
* @return
*/
public Long getIdEtatDossier() {
return idEtatDossier;
}
/**
*
* @return
*/
public Boolean getIsClosed() {
return (idEtatDossier == Constant.ID_DOSSIER_CLOS);
}
/**
*
* @param value
*/
public void setIdEtatDossier(Long value) {
this.idEtatDossier = value;
}
/**
*
* @return
*/
public Patient getPatient() {
return patient;
}
/**
*
* @param value
*/
public void setPatient(Patient value) {
this.patient = value;
}
/**
*
* @param idPatient
*/
public void setIdPatient(Long idPatient) {
this.idPatient = idPatient;
}
/**
*
* @return
*/
public Long getIdPatient() {
return idPatient;
}
/**
*
* @return
*/
public Intervention getIntervention() {
return intervention;
}
/**
*
* @param value
*/
public void setIntervention(Intervention value) {
this.intervention = value;
}
/**
*
* @return
*/
public BilanPreOp getBilanPreOp() {
return bilanPreOp;
}
/**
*
* @param value
*/
public void setBilanPreOp(BilanPreOp value) {
this.bilanPreOp = value;
}
/**
*
* @return
*/
public List<Examen> getListExamen() {
// on trie par ordre de numero d'examen
/*
* boolean bPermut = true; while (bPermut) { bPermut = false; for (int i
* = 0; i < listExamen.size() - 1; i++) { Examen examen1 =
* listExamen.get(i); Examen examen2 = listExamen.get(i + 1);
*
* if (examen1.getNumero() > examen2.getNumero()) { listExamen.remove(i
* + 1); listExamen.add(i, examen2); bPermut = true; } } }
*/
return listExamen;
}
/**
*
* @param value
*/
public void setListExamen(List<Examen> value) {
this.listExamen = value;
}
/**
*
* @return
*/
public String getNom() {
return nom;
}
/**
*
* @param value
*/
public void setNom(String value) {
this.nom = value;
}
/**
*
* @return
*/
public Long getIdCompartiment() {
return idCompartiment;
}
/**
*
* @param value
*/
public void setIdCompartiment(Long value) {
if (isValidValue(value))
this.idCompartiment = value;
else
this.idCompartiment = null;
}
/**
*
* @return
*/
public Long getIdCoteOp() {
return idCoteOp;
}
/**
*
* @param value
*/
public void setIdCoteOp(Long value) {
if (isValidValue(value))
this.idCoteOp = value;
else
this.idCoteOp = null;
}
/**
*
* @return
*/
public Long getIdTypeOp() {
return idTypeOp;
}
/**
*
* @param value
*/
public void setIdTypeOp(Long value) {
if (isValidValue(value))
this.idTypeOp = value;
else
this.idTypeOp = null;
}
/**
*
* @return
*/
public Long getIdEtatPatient() {
return idEtatPatient;
}
/**
*
* @param value
*/
public void setIdEtatPatient(Long value) {
if (isValidValue(value))
this.idEtatPatient = value;
else
this.idEtatPatient = null;
}
/**
*
* @return
*/
public Date getDateDernierControle() {
return dateDernierControle;
}
/**
*
* @param dateDernierControle
*/
public void setDateDernierControle(Date dateDernierControle) {
this.dateDernierControle = dateDernierControle;
}
/**
*
* @return
*/
public Integer getNumeroDernierControle() {
return numeroDernierControle;
}
/**
*
* @param numeroDernierControle
*/
public void setNumeroDernierControle(Integer numeroDernierControle) {
this.numeroDernierControle = numeroDernierControle;
}
/**
*
* @return
*/
public Integer getRecul() {
return recul;
}
/**
*
* @param recul
*/
public void setRecul(Integer recul) {
this.recul = recul;
}
// ////////////////////////////////
/**
*
* @param etape
*/
public void setEtape(Etape[] etape) {
this.etape = etape;
}
/**
*
* @return
*/
public Date getDateCloture() {
return dateCloture;
}
/**
*
* @param sDateCloture
*/
public void setDateCloture(String sDateCloture) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
try {
this.dateCloture = sdf.parse(sDateCloture);
} catch (Exception ex) {
}
}
/**
*
* @param dateCloture
*/
public void setDateCloture(Date dateCloture) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
try {
this.dateCloture = sdf.parse(sdf.format(dateCloture));
} catch (Exception ex) {
}
}
/**
*
* @return
*/
public Etape[] getEtape() {
// il faut remplir le tableau etape à chaque appel à getEtape()
etape[ePREOP] = bilanPreOp;
// List<Examen> list = getListExamen();
for (int i = 0; i < listExamen.size(); i++) {
etape[eC1 + i] = listExamen.get(i);
}
return etape;
}
/**
*
* @param nEtape
* @return
*/
public Etape getAnEtape(Long nEtape) {
getEtape(); // remplissage
return etape[NumberUtil.intValue(nEtape)];
}
/**
*
* @param numEtape
* @return
*/
public int numExFromNumEtape(Long numEtape) {
return (NumberUtil.intValue(numEtape) - eC1);
}
/**
*
* @return
*/
public int getEPREOP() {
return ePREOP;
}
/**
*
* @return
*/
public int getEC1() {
return eC1;
}
/**
*
* @return
*/
public boolean getIsGenou() {
if (((getIdTypeOp() == Constant.ID_PUC) || getIdTypeOp() == Constant.ID_PTG)
|| (getIdTypeOp() == Constant.ID_PTG_REVISION))
return true;
else
return false;
}
/**
*
* @return
*/
public boolean getIsHanche() {
if ((getIdTypeOp() == Constant.ID_PTH)
|| (getIdTypeOp() == Constant.ID_PTH_REVISION))
return true;
else
return false;
}
/**
*
* @return
*/
public boolean getIsRevision() {
if ((getIdTypeOp() == Constant.ID_PTH_REVISION)
|| (getIdTypeOp() == Constant.ID_PTG_REVISION))
return true;
else
return false;
}
/**
*
* @return
*/
public boolean getIsPUC() {
if (getIdTypeOp() == Constant.ID_PUC)
return true;
else
return false;
}
/**
*
* @return
*/
public boolean getIsPTG() {
if (getIdTypeOp() == Constant.ID_PTG)
return true;
else
return false;
}
/**
*
* @return
*/
public boolean getIsPTGRevision() {
if (getIdTypeOp() == Constant.ID_PTG_REVISION)
return true;
return false;
}
/**
*
* @return
*/
public boolean getIsPTH() {
if (getIdTypeOp() == Constant.ID_PTH)
return true;
return false;
}
/**
*
* @return
*/
public boolean getIsPTHRevision() {
if (getIdTypeOp() == Constant.ID_PTH_REVISION)
return true;
return false;
}
/* ************************************************ */
@Override
public boolean equals(Object obj) {
boolean equal = obj instanceof Dossier;
if (equal) {
Dossier r = (Dossier) obj;
equal = this.getClass().getName().equals(r.getClass().getName());
if (equal) {
equal = getId().equals(r.getId());
}
}
return equal;
}
/**
*
* @return
*/
public String getSyncState() {
return syncState;
}
/**
*
* @param syncState
*/
public void setSyncState(String syncState) {
this.syncState = syncState;
}
@Override
public String toString() {
String nullString = "null";
StringBuilder str = new StringBuilder();
str.append("\n [DOSSIER] id : " + getId());
str.append(", idUser : "
+ (user != null ? user.getId() : nullString));
str.append(", numImplant : " + numImplant);
str.append(", nom : " + nom);
str.append(", patient : "
+ (patient != null ? patient.toString() : nullString));
str.append(", dateDernierControle : "
+ (dateDernierControle != null ? dateDernierControle.toString()
: nullString));
str.append(", idCompartiment : " + idCompartiment);
str.append(", idCoteOp : " + idCoteOp);
str.append(", idTypeOp : " + idTypeOp);
str.append(", intervention : "
+ (intervention != null ? intervention.toString() : nullString));
str.append(", bilanPreOp : "
+ (bilanPreOp != null ? bilanPreOp.toString() : nullString));
str.append(", version : " + getVersion());
str.append(", synchroVersion : " + getSynchroVersion());
return str.toString();
}
/**
* This version of the copy method is especially written for
* synchronization.
*/
// @Override
// public Object copy() throws CopyException {
// Dossier dossier = (Dossier) super.copy();
// // Deep copy, when necessary
// if (patient != null) {
// dossier.setPatient((Patient) patient.copy());
// }
// if (bilanPreOp != null) {
// dossier.setBilanPreOp((BilanPreOp) bilanPreOp.copy());
// }
// if (intervention != null) {
// dossier.setIntervention((Intervention) intervention.copy());
// }
// if (antecedent != null) {
// dossier.setAntecedent((Antecedent) antecedent.copy());
// }
// if (bilanFH != null) {
// dossier.setBilanFH((BilanFH) bilanFH.copy());
// }
// if (amplivision != null) {
// dossier.setAmplivision((Amplivision) amplivision.copy());
// }
// if (convocation != null) {
// dossier.setConvocation((Convocation) convocation.copy());
// }
// List
/**
* This version of the copy method is especially written for
synchronization. * @param exam */ public void removeExamen(Examen exam) { listExamen.remove(exam); Etape[] etapeTmp = new Etape[etape.length - 1]; int j = 0; for (int i = 0; i < etape.length - 1; i++) { if (etape[i] != exam) { etapeTmp[j] = etape[i]; j++; } } etape = etapeTmp; }
/**
* @return the idBilanPreOp
*/
public Long getIdBilanPreOp() {
return idBilanPreOp;
}
/**
* @param idBilanPreOp the idBilanPreOp to set
*/
public void setIdBilanPreOp(Long idBilanPreOp) {
this.idBilanPreOp = idBilanPreOp;
}
/**
* @return the idIntervention
*/
public Long getIdIntervention() {
return idIntervention;
}
/**
* @param idIntervention the idIntervention to set
*/
public void setIdIntervention(Long idIntervention) {
this.idIntervention = idIntervention;
}
/**
*
*/
public class DossierIdComparateur implements Comparator<Dossier> {
@Override
public int compare(Dossier d1, Dossier d2) {
if (d1.getId() == null) {
return (d2.getId() != null ? -1 : 0);
}
if (d2.getId() == null) {
return (d1.getId() != null ? 1 : 0);
}
return NumberUtil.intValue(d1.getId())-NumberUtil.intValue(d2.getId());
}
}
/**
*
* @return
*/
public String getDefautValuePossible(){
if(isParamForm())
return "_defaultValuePossible";
else
return "";
}
/**
*
* @return
*/
public boolean isParamForm()
{
if((getIdEtatDossier()!=null && getIdEtatDossier()==Constant.ID_DOSSIER_PARAMFORM) || patient.isParamFormUser())
return true;
else
return false;
}
/**
*
* @return
*/
public Boolean getInfoPatient() {
return infoPatient;
}
/**
*
* @param infoPatient
*/
public void setInfoPatient(Boolean infoPatient) {
this.infoPatient = infoPatient;
}
}
I really appreciate if you can help me because I need this feature to simplify the JSON importation in my database. Thanks in advance.
I am having difficulty reproducing the issue. Any chance you can send me the project so I can try building it myself. (Either share a private github repo with me - or send it to my email). My email is steve@weblite.ca
Thanks but I finally found the problem : In my Dossier class, I have a method that implements Comparator interface which is not supported by CodenameOne.
could you add a parameter for the mirah precompilation which permit to specify a custom src directory. I mean I would like to compile with mirah only my model because my ModelDataMapper.mirah is in this directory so it is not necessary to compile others packages. Thanks :)
This is tricky because if Mirah refers to any classes that are defined in the Java source, then I need to first compile stubs of the java source -- otherwise Mirah will throw ClassNotFound errors. E.g. your ModelDataMapper likely refers to at least the Java classes that you are creating mappers for.
I would like to use mirah only with my model's classes, so is it possible to exclude java classes during mirah compilation? Thanks. (It seems I have a problem with the netbeans mirah module, because I have no suggestion when I'm implementing in a mirah class.)