[Pydev-cvs] org.python.pydev.refactoring/src/org/python/pydev/refactoring/ast/visitors VisitorFact
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2007-03-01 17:30:56
|
Update of /cvsroot/pydev/org.python.pydev.refactoring/src/org/python/pydev/refactoring/ast/visitors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31788/src/org/python/pydev/refactoring/ast/visitors Modified Files: VisitorFactory.java Log Message: Fixes for it to work with java 1.4 Index: VisitorFactory.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/src/org/python/pydev/refactoring/ast/visitors/VisitorFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VisitorFactory.java 27 Feb 2007 16:44:03 -0000 1.3 --- VisitorFactory.java 1 Mar 2007 17:30:53 -0000 1.4 *************** *** 101,109 **** } public static <T extends AbstractContextVisitor> T createContextVisitor(Class<T> visitorClass, SimpleNode root, ModuleAdapter module, AbstractNodeAdapter parent) { T visitor = null; try { ! visitor = visitorClass.cast(visitorClass.getConstructors()[0].newInstance(new Object[] { module, parent })); root.accept(visitor); } catch (Throwable e) { --- 101,113 ---- } + /** + * Unchecked (because if doing Class.cast, it does not work in java 1.4) + */ + @SuppressWarnings("unchecked") public static <T extends AbstractContextVisitor> T createContextVisitor(Class<T> visitorClass, SimpleNode root, ModuleAdapter module, AbstractNodeAdapter parent) { T visitor = null; try { ! visitor = (T) visitorClass.getConstructors()[0].newInstance(new Object[] { module, parent }); root.accept(visitor); } catch (Throwable e) { |