From: hansonr Date: Mon, 2 Jul 2018 15:37:26 +0000 (+0100) Subject: JAL-3026 GD#75 Stockholm file load fails X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~610 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=98fdba84857a44ec1ace01181c9a00dd84509ac6;p=jalview.git JAL-3026 GD#75 Stockholm file load fails Transpiler and runtime fixes for enhanced for syntax with implicit variable type changing, boxing, and unboxing. JavaScript alternative to using reflection method getClass().getFields() --- diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index 7a30141..47d1082 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -25,6 +25,9 @@ import java.util.ArrayList; import java.util.List; /** + * BH 2018 SwingJS note: If additional final static Strings are added to this + * file, they should be added to public static final String[] allTypes. + * * Defines internal constants for unambiguous annotation of DbRefEntry source * strings and describing the data retrieved from external database sources (see * jalview.ws.DbSourcProxy)
@@ -32,11 +35,16 @@ import java.util.List; * (e.g. protein coding, alignment (ortholog db, paralog db, domain db), * genomic, transcriptomic, 3D structure providing (PDB, MODBASE, etc) ..). * + * + * * @author JimP * */ public class DBRefSource { + + + /** * UNIPROT Accession Number */ @@ -52,9 +60,9 @@ public class DBRefSource */ public static final String UNIPROTKB = "UniProtKB/TrEMBL".toUpperCase(); - public static final String EMBLCDSProduct = "EMBLCDSProtein" - .toUpperCase(); + public static final String EMBLCDSProduct = "EMBLCDSProtein".toUpperCase(); + /** * PDB Entry Code */ @@ -70,6 +78,7 @@ public class DBRefSource */ public static final String EMBLCDS = "EMBLCDS"; + /** * PFAM ID */ @@ -85,6 +94,7 @@ public class DBRefSource */ public static final String GENEDB = "GeneDB".toUpperCase(); + /** * Ensembl */ @@ -92,7 +102,8 @@ public class DBRefSource public static final String ENSEMBLGENOMES = "ENSEMBLGENOMES"; - /** + + /** * List of databases whose sequences might have coding regions annotated */ public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB, @@ -103,22 +114,49 @@ public class DBRefSource public static final String[] PROTEINDBS = { UNIPROT, UNIPROTKB, EMBLCDSProduct, ENSEMBL }; // Ensembl ENSP* entries are protein + + public static final String[] allTypes = new String[] { + UNIPROT, UP_NAME, UNIPROTKB, + EMBLCDSProduct, PDB, EMBL, + EMBLCDS, PFAM, RFAM, + GENEDB, ENSEMBL, ENSEMBLGENOMES + }; + + + public static String[] allSourcesFromReflection; + public static String[] allSources() + { - List src = new ArrayList<>(); - for (Field f : DBRefSource.class.getFields()) + /** + * @j2sNative + * + * return C$.allTypes; + * + */ + { - if (String.class.equals(f.getType())) + if (allSourcesFromReflection == null) { - try - { - src.add((String) f.get(null)); - } catch (Exception x) + List src = new ArrayList<>(); + for (Field f : DBRefSource.class.getFields()) { - x.printStackTrace(); + if (String.class.equals(f.getType())) + { + try + { + src.add((String) f.get(null)); + } catch (Exception x) + { + x.printStackTrace(); + } + } } + allSourcesFromReflection = src.toArray(new String[0]); } + return allSourcesFromReflection; } - return src.toArray(new String[0]); } + + } diff --git a/swingjs/SwingJS-site.zip b/swingjs/SwingJS-site.zip index 11f9d44..988e63d 100644 Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ diff --git a/swingjs/net.sf.j2s.core.jar b/swingjs/net.sf.j2s.core.jar index 950a40e..0aa84ff 100644 Binary files a/swingjs/net.sf.j2s.core.jar and b/swingjs/net.sf.j2s.core.jar differ