This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 36abf69  Trivial refactoring: Replace AIC with lambda and method 
reference
36abf69 is described below

commit 36abf696dce783190cfd39f417dad24971f6fc53
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Apr 11 21:31:22 2020 +0800

    Trivial refactoring: Replace AIC with lambda and method reference
---
 .../groovy-xml/src/main/java/groovy/xml/FactorySupport.java  | 12 ++----------
 .../groovy-xml/src/main/java/groovy/xml/XmlSlurper.java      |  6 +-----
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git 
a/subprojects/groovy-xml/src/main/java/groovy/xml/FactorySupport.java 
b/subprojects/groovy-xml/src/main/java/groovy/xml/FactorySupport.java
index c2385c5..a6d57c7 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/xml/FactorySupport.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/xml/FactorySupport.java
@@ -45,18 +45,10 @@ public class FactorySupport {
     }
 
     public static DocumentBuilderFactory createDocumentBuilderFactory() throws 
ParserConfigurationException {
-        return (DocumentBuilderFactory) createFactory(new 
PrivilegedExceptionAction() {
-            public Object run() throws ParserConfigurationException {
-                return DocumentBuilderFactory.newInstance();
-            }
-        });
+        return (DocumentBuilderFactory) 
createFactory(DocumentBuilderFactory::newInstance);
     }
 
     public static SAXParserFactory createSaxParserFactory() throws 
ParserConfigurationException {
-        return (SAXParserFactory) createFactory(new 
PrivilegedExceptionAction() {
-                public Object run() throws ParserConfigurationException {
-                    return SAXParserFactory.newInstance();
-                }
-            });
+        return (SAXParserFactory) createFactory(SAXParserFactory::newInstance);
     }
 }
diff --git a/subprojects/groovy-xml/src/main/java/groovy/xml/XmlSlurper.java 
b/subprojects/groovy-xml/src/main/java/groovy/xml/XmlSlurper.java
index 6463a95..5c3354a 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/xml/XmlSlurper.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/xml/XmlSlurper.java
@@ -339,11 +339,7 @@ public class XmlSlurper extends DefaultHandler {
      * @param base The URL used to resolve relative URLs
      */
     public void setEntityBaseUrl(final URL base) {
-        reader.setEntityResolver(new EntityResolver() {
-            public InputSource resolveEntity(final String publicId, final 
String systemId) throws IOException {
-                return new InputSource(new URL(base, systemId).openStream());
-            }
-        });
+        reader.setEntityResolver((publicId, systemId) -> new InputSource(new 
URL(base, systemId).openStream()));
     }
 
     /* (non-Javadoc)

Reply via email to