This looks OK to me. One suggestion - when doing "unobvious" changes, it would probably be helpful (for future maintainers) to put comments why (and maybe include a ref to the Jira issue), into the actual source code.
-Marshall On 1/12/2013 2:52 PM, [email protected] wrote: > Author: rec > Date: Sat Jan 12 19:52:57 2013 > New Revision: 1432494 > > URL: http://svn.apache.org/viewvc?rev=1432494&view=rev > Log: > Issue UIMA-2565: uimaj-core doesn't build on JDK 7 > https://issues.apache.org/jira/browse/UIMA-2565 > - Use full type name org.apache.uima.cas.Type where necessary to avoid clash > with Window.Type > - Added generic types to several collections and removed then unnecessary > type casts > - Added a missing @Override annotation on an anonymous sub-class of > WindowAdapter > > Modified: > > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java > > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java > > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java > > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java > > Modified: > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java > URL: > http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java?rev=1432494&r1=1432493&r2=1432494&view=diff > ============================================================================== > --- > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java > (original) > +++ > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/AnnotationDisplayCustomizationFrame.java > Sat Jan 12 19:52:57 2013 > @@ -48,7 +48,6 @@ import javax.swing.tree.DefaultTreeModel > import javax.swing.tree.TreeModel; > > import org.apache.uima.cas.CAS; > -import org.apache.uima.cas.Type; > import org.apache.uima.cas.TypeSystem; > > /** > @@ -336,17 +335,17 @@ public class AnnotationDisplayCustomizat > private TreeModel createTreeModel(TypeSystem ts) { > String typeName = CAS.TYPE_NAME_ANNOTATION; > DefaultMutableTreeNode node = new DefaultMutableTreeNode(typeName); > - Type type = ts.getType(typeName); > + org.apache.uima.cas.Type type = ts.getType(typeName); > addChildren(node, type, ts); > DefaultTreeModel treeModel = new DefaultTreeModel(node); > return treeModel; > } > > - @SuppressWarnings("unchecked") > - private static void addChildren(DefaultMutableTreeNode node, Type type, > TypeSystem ts) { > - List<Type> dtrs = ts.getDirectSubtypes(type); > + private static void addChildren(DefaultMutableTreeNode node, > org.apache.uima.cas.Type type, > + TypeSystem ts) { > + List<org.apache.uima.cas.Type> dtrs = ts.getDirectSubtypes(type); > DefaultMutableTreeNode dtrNode; > - Type dtrType; > + org.apache.uima.cas.Type dtrType; > for (int i = 0; i < dtrs.size(); i++) { > dtrType = dtrs.get(i); > dtrNode = new DefaultMutableTreeNode(dtrType.getName()); > @@ -354,5 +353,4 @@ public class AnnotationDisplayCustomizat > addChildren(dtrNode, dtrType, ts); > } > } > - > } > > Modified: > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java > URL: > http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java?rev=1432494&r1=1432493&r2=1432494&view=diff > ============================================================================== > --- > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java > (original) > +++ > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java > Sat Jan 12 19:52:57 2013 > @@ -96,7 +96,6 @@ import org.apache.uima.cas.FSIndex; > import org.apache.uima.cas.FSIndexRepository; > import org.apache.uima.cas.Feature; > import org.apache.uima.cas.SofaFS; > -import org.apache.uima.cas.Type; > import org.apache.uima.cas.TypeSystem; > import org.apache.uima.cas.impl.CASImpl; > import org.apache.uima.cas.impl.XmiCasDeserializer; > @@ -1343,6 +1342,7 @@ public class MainFrame extends JFrame { > private void init() { > this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); > this.addWindowListener(new WindowAdapter() { > + @Override > public void windowClosing(WindowEvent e) { > // Do nothing. > } > @@ -1653,13 +1653,12 @@ public class MainFrame extends JFrame { > return res; > } > > - @SuppressWarnings("unchecked") > - private DefaultMutableTreeNode createTypeTree(Type type, TypeSystem ts, > String label, > - FSIndexRepository ir) { > + private DefaultMutableTreeNode createTypeTree(org.apache.uima.cas.Type > type, TypeSystem ts, > + String label, FSIndexRepository ir) { > int size = ir.getIndex(label, type).size(); > TypeTreeNode typeNode = new TypeTreeNode(type, label, size); > DefaultMutableTreeNode node = new DefaultMutableTreeNode(typeNode); > - List<Type> types = ts.getDirectSubtypes(type); > + List<org.apache.uima.cas.Type> types = ts.getDirectSubtypes(type); > final int max = types.size(); > for (int i = 0; i < max; i++) { > if (ir.getIndex(label, types.get(i)) == null) { > > Modified: > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java > URL: > http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java?rev=1432494&r1=1432493&r2=1432494&view=diff > ============================================================================== > --- > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java > (original) > +++ > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/tsview/MainFrame.java > Sat Jan 12 19:52:57 2013 > @@ -44,7 +44,6 @@ import javax.swing.tree.DefaultTreeSelec > import javax.swing.tree.TreeSelectionModel; > > import org.apache.uima.cas.CAS; > -import org.apache.uima.cas.Type; > import org.apache.uima.cas.TypeSystem; > import org.apache.uima.cas.admin.CASFactory; > import org.apache.uima.cas.admin.CASMgr; > @@ -69,7 +68,7 @@ public class MainFrame extends JFrame { > if (node == null) { > return; > } > - Type t = (Type) node.getUserObject(); > + org.apache.uima.cas.Type t = (org.apache.uima.cas.Type) > node.getUserObject(); > if (t != null) { > MainFrame.this.selectedType = t; > updateFeatureTable(); > @@ -79,7 +78,7 @@ public class MainFrame extends JFrame { > > TypeSystem ts = null; > > - private Type selectedType; > + private org.apache.uima.cas.Type selectedType; > > private JTable featureTable = null; > > @@ -181,12 +180,12 @@ public class MainFrame extends JFrame { > ((FeatureTableModel) > this.featureTable.getModel()).setType(this.selectedType); > } > > - private DefaultMutableTreeNode createTypeTree(Type type) { > + private DefaultMutableTreeNode createTypeTree(org.apache.uima.cas.Type > type) { > DefaultMutableTreeNode node = new DefaultMutableTreeNode(type); > - List<?> types = this.ts.getDirectSubtypes(type); > + List<org.apache.uima.cas.Type> types = this.ts.getDirectSubtypes(type); > final int max = types.size(); > for (int i = 0; i < max; i++) { > - DefaultMutableTreeNode child = createTypeTree((Type) types.get(i)); > + DefaultMutableTreeNode child = createTypeTree(types.get(i)); > node.add(child); > } > return node; > @@ -198,11 +197,11 @@ public class MainFrame extends JFrame { > } > DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) > this.typeTree.getModel().getRoot(); > rootNode.removeAllChildren(); > - Type top = this.ts.getTopType(); > + org.apache.uima.cas.Type top = this.ts.getTopType(); > rootNode.setUserObject(top); > - List<?> types = this.ts.getDirectSubtypes(top); > + List<org.apache.uima.cas.Type> types = this.ts.getDirectSubtypes(top); > for (int i = 0; i < types.size(); i++) { > - rootNode.add(createTypeTree((Type) types.get(i))); > + rootNode.add(createTypeTree(types.get(i))); > } > DefaultTreeModel model = (DefaultTreeModel) this.typeTree.getModel(); > // 1.3 compatability hack. > > Modified: > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java > URL: > http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java?rev=1432494&r1=1432493&r2=1432494&view=diff > ============================================================================== > --- > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java > (original) > +++ > uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/DocumentAnalyzer.java > Sat Jan 12 19:52:57 2013 > @@ -73,7 +73,6 @@ import org.apache.uima.analysis_engine.T > import org.apache.uima.analysis_engine.metadata.FixedFlow; > import org.apache.uima.analysis_engine.metadata.SofaMapping; > import org.apache.uima.cas.CAS; > -import org.apache.uima.cas.Type; > import org.apache.uima.cas.TypeSystem; > import org.apache.uima.collection.CasConsumerDescription; > import org.apache.uima.collection.CollectionProcessingManager; > @@ -1183,7 +1182,7 @@ public class DocumentAnalyzer extends JF > > // save AE output types for later use in configuring viewer > if (aeSpecifier instanceof AnalysisEngineDescription) { > - ArrayList outputTypeList = new ArrayList(); > + ArrayList<String> outputTypeList = new ArrayList<String>(); > Capability[] capabilities = ((AnalysisEngineDescription) aeSpecifier) > .getAnalysisEngineMetaData().getCapabilities(); > for (int i = 0; i < capabilities.length; i++) { > @@ -1192,12 +1191,13 @@ public class DocumentAnalyzer extends JF > if (outputs[j].isType()) { > outputTypeList.add(outputs[j].getName()); > // also add subsumed types > - Type t = currentTypeSystem.getType(outputs[j].getName()); > + org.apache.uima.cas.Type t = > currentTypeSystem.getType(outputs[j].getName()); > if (t != null) { > - List subsumedTypes = > currentTypeSystem.getProperlySubsumedTypes(t); > - Iterator it = subsumedTypes.iterator(); > + List<org.apache.uima.cas.Type> subsumedTypes = > currentTypeSystem > + .getProperlySubsumedTypes(t); > + Iterator<org.apache.uima.cas.Type> it = > subsumedTypes.iterator(); > while (it.hasNext()) { > - outputTypeList.add(((Type) it.next()).getName()); > + outputTypeList.add(it.next().getName()); > } > } > } > @@ -1261,6 +1261,7 @@ public class DocumentAnalyzer extends JF > this.encoding = encoding; > } > > + @Override > public void run() { > // Code moved outside class to make accessible by programs that call > // DocumentAnalyzer. JMP > @@ -1291,6 +1292,7 @@ public class DocumentAnalyzer extends JF > * > * @see java.awt.Component#getPreferredSize() > */ > + @Override > public Dimension getPreferredSize() { > return new Dimension(700, 350); > } > > >
