You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/06/05 18:42:57 UTC
svn commit: r1683807 - in /sis/branches/JDK7: ./
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
Author: desruisseaux
Date: Fri Jun 5 16:42:57 2015
New Revision: 1683807
URL: http://svn.apache.org/r1683807
Log:
Merge from the JDK8 branch the removal of unecessary reflection code.
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 5 16:42:57 2015
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1683752
+/sis/branches/JDK8:1584960-1683803
/sis/trunk:1394364-1508466,1519089-1519674
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1683807&r1=1683806&r2=1683807&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Fri Jun 5 16:42:57 2015
@@ -187,13 +187,6 @@ final class GeodeticObjectParser extends
/**
* Constructs a parser for the specified set of symbols using the specified set of factories.
*
- * This constructor is for internal usage by Apache SIS only — <b>do not use!</b>
- *
- * <p><b>Maintenance note:</b> this constructor is invoked through reflection by
- * {@link WKTFormat#parse(CharSequence, ParsePosition)} because of modularization.
- * Do not change the method signature even if it doesn't break the compilation,
- * unless the reflection code is also updated.</p>
- *
* @param symbols The set of symbols to use.
* @param convention The WKT convention to use.
* @param isAxisIgnored {@code true} if {@code AXIS} elements should be ignored.
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1683807&r1=1683806&r2=1683807&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Fri Jun 5 16:42:57 2015
@@ -28,13 +28,11 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.ParsePosition;
import java.text.ParseException;
-import java.lang.reflect.Constructor;
import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
import org.opengis.util.Factory;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.io.CompoundFormat;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
@@ -98,13 +96,6 @@ public class WKTFormat extends CompoundF
private static final long serialVersionUID = -2909110214650709560L;
/**
- * The constructor for WKT parsers, fetched when first needed. We have to use reflection
- * because {@link GeodeticObjectParser} is defined in a separated module which is not
- * guaranteed to be on the classpath.
- */
- private static volatile Constructor<? extends Parser> parserConstructor;
-
- /**
* The indentation value to give to the {@link #setIndentation(int)}
* method for formatting the complete object on a single line.
*/
@@ -508,22 +499,11 @@ public class WKTFormat extends CompoundF
*/
@Override
public Object parse(final CharSequence text, final ParsePosition pos) throws ParseException {
- if (parser == null) try {
- Constructor<? extends Parser> c = parserConstructor;
- if (c == null) {
- c = Class.forName("org.apache.sis.io.wkt.GeodeticObjectParser").asSubclass(Parser.class)
- .getDeclaredConstructor(Symbols.class, Convention.class, Boolean.TYPE, Locale.class, Map.class);
- parserConstructor = c;
- }
+ if (parser == null) {
if (factories == null) {
factories = new HashMap<>();
}
- parser = c.newInstance(symbols, convention, false, getLocale(Locale.Category.DISPLAY), factories);
- } catch (ClassNotFoundException e) {
- throw (ParseException) new LocalizedParseException(getLocale(Locale.Category.DISPLAY),
- Errors.Keys.MissingRequiredModule_1, new String[] {"sis-referencing"}, 0).initCause(e);
- } catch (ReflectiveOperationException e) {
- throw (ParseException) new ParseException(e.getMessage(), 0).initCause(e);
+ parser = new GeodeticObjectParser(symbols, convention, false, getLocale(Locale.Category.DISPLAY), factories);
}
return parser.parseObject(text.toString(), pos);
}