< prev index next >

make/jdk/src/classes/build/tools/jdwpgen/Parse.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -25,10 +25,11 @@
 
 package build.tools.jdwpgen;
 
 import java.util.*;
 import java.io.*;
+import java.lang.reflect.InvocationTargetException;
 
 class Parse {
 
     final StreamTokenizer izer;
     final Map<String, Node> kindMap = new HashMap<String, Node>();

@@ -142,16 +143,22 @@
                     if (proto == null) {
                         error("Invalid kind: " + kind);
                         return null;
                     } else {
                         try {
-                            Node node = (Node)proto.getClass().newInstance();
+                            Node node = (Node)proto.getClass().getDeclaredConstructor().newInstance();
                             node.set(kind, list, izer.lineno());
                             return node;
                         } catch (InstantiationException exc) {
                             error(exc.toString());
                             return null;
+                        } catch (NoSuchMethodException exc) {
+                            error(exc.toString());
+                            return null;
+                        } catch (InvocationTargetException exc) {
+                            error(exc.toString());
+                            return null;
                         } catch (IllegalAccessException exc) {
                             error(exc.toString());
                             return null;
                         }
                     }
< prev index next >