Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ebf3b473
Commit
ebf3b473
authored
Sep 28, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ExtendedGroovyClassLoader compatible with Java 9
Closes gh-10445
parent
bec2e97b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
ExtendedGroovyClassLoader.java
...ramework/boot/cli/compiler/ExtendedGroovyClassLoader.java
+5
-2
ExtendedGroovyClassLoaderTests.java
...ork/boot/cli/compiler/ExtendedGroovyClassLoaderTests.java
+7
-1
No files found.
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java
View file @
ebf3b473
...
@@ -175,7 +175,8 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
...
@@ -175,7 +175,8 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
DefaultScopeParentClassLoader
(
ClassLoader
parent
)
{
DefaultScopeParentClassLoader
(
ClassLoader
parent
)
{
super
(
parent
);
super
(
parent
);
this
.
groovyOnlyClassLoader
=
new
URLClassLoader
(
getGroovyJars
(
parent
),
null
);
this
.
groovyOnlyClassLoader
=
new
URLClassLoader
(
getGroovyJars
(
parent
),
parent
.
getParent
());
}
}
private
URL
[]
getGroovyJars
(
final
ClassLoader
parent
)
{
private
URL
[]
getGroovyJars
(
final
ClassLoader
parent
)
{
...
@@ -232,7 +233,9 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
...
@@ -232,7 +233,9 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
@Override
@Override
protected
Class
<?>
loadClass
(
String
name
,
boolean
resolve
)
protected
Class
<?>
loadClass
(
String
name
,
boolean
resolve
)
throws
ClassNotFoundException
{
throws
ClassNotFoundException
{
this
.
groovyOnlyClassLoader
.
loadClass
(
name
);
if
(!
name
.
startsWith
(
"java."
))
{
this
.
groovyOnlyClassLoader
.
loadClass
(
name
);
}
return
super
.
loadClass
(
name
,
resolve
);
return
super
.
loadClass
(
name
,
resolve
);
}
}
...
...
spring-boot-cli/src/test/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoaderTests.java
View file @
ebf3b473
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -64,4 +64,10 @@ public class ExtendedGroovyClassLoaderTests {
...
@@ -64,4 +64,10 @@ public class ExtendedGroovyClassLoaderTests {
this
.
defaultScopeGroovyClassLoader
.
loadClass
(
"java.lang.Boolean"
);
this
.
defaultScopeGroovyClassLoader
.
loadClass
(
"java.lang.Boolean"
);
}
}
@Test
public
void
loadsSqlTypes
()
throws
Exception
{
this
.
contextClassLoader
.
loadClass
(
"java.sql.SQLException"
);
this
.
defaultScopeGroovyClassLoader
.
loadClass
(
"java.sql.SQLException"
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment