-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Provide GraalVM metadata and substitutions #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e249c02
61c0127
f7ffe8a
db998ac
92ac5ae
7b10c60
18a1496
261841a
fe51f0e
7c8b08a
3929143
77cb614
a244a63
3bc66d2
be64442
faaba04
841f67b
c3ab8da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"name":"java.lang.Object", | ||
"queryAllDeclaredMethods":true | ||
}, | ||
{ | ||
"name":"sun.security.provider.NativePRNG", | ||
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"<init>","parameterTypes":["java.security.SecureRandomParameters"] }] | ||
}, | ||
{ | ||
"name":"sun.security.provider.SHA", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"org.slf4j.Logger" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.mongodb.internal.graalvm.substitution; | ||
|
||
import com.mongodb.UnixServerAddress; | ||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
|
||
@TargetClass(UnixServerAddress.class) | ||
public final class UnixServerAddressSubstitution { | ||
@Substitute | ||
private static void checkNotInGraalVmNativeImage() { | ||
throw new UnsupportedOperationException("UnixServerAddress is not supported in GraalVM native image"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually achievable also via
|
||
} | ||
|
||
private UnixServerAddressSubstitution() { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
[ | ||
{ | ||
"name":"com.mongodb.BasicDBObject", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a slightly different set of reflection registrations. But, I believe yours are more accurate.
jyemin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.mongodb.MongoNamespace", | ||
"allDeclaredFields":true, | ||
"queryAllDeclaredMethods":true, | ||
"queryAllDeclaredConstructors":true | ||
}, | ||
{ | ||
"name":"com.mongodb.WriteConcern", | ||
"allPublicFields":true | ||
}, | ||
{ | ||
"name":"com.mongodb.client.model.changestream.ChangeStreamDocument", | ||
"allDeclaredFields":true, | ||
"queryAllDeclaredMethods":true, | ||
"queryAllDeclaredConstructors":true, | ||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","org.bson.BsonDocument","org.bson.BsonDocument","org.bson.BsonDocument","java.lang.Object","java.lang.Object","org.bson.BsonDocument","org.bson.BsonTimestamp","com.mongodb.client.model.changestream.UpdateDescription","org.bson.BsonInt64","org.bson.BsonDocument","org.bson.BsonDateTime","com.mongodb.client.model.changestream.SplitEvent","org.bson.BsonDocument"] }] | ||
}, | ||
{ | ||
"name":"com.mongodb.client.model.changestream.SplitEvent", | ||
"allDeclaredFields":true, | ||
"queryAllDeclaredMethods":true, | ||
"queryAllDeclaredConstructors":true | ||
}, | ||
{ | ||
"name":"com.mongodb.client.model.changestream.TruncatedArray", | ||
"allDeclaredFields":true, | ||
"queryAllDeclaredMethods":true, | ||
"queryAllDeclaredConstructors":true | ||
}, | ||
{ | ||
"name":"com.mongodb.client.model.changestream.UpdateDescription", | ||
"allDeclaredFields":true, | ||
"queryAllDeclaredMethods":true, | ||
"queryAllDeclaredConstructors":true, | ||
"methods":[{"name":"<init>","parameterTypes":["java.util.List","org.bson.BsonDocument","java.util.List","org.bson.BsonDocument"] }] | ||
}, | ||
{ | ||
jyemin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"name":"java.lang.Record" | ||
}, | ||
{ | ||
"name":"java.lang.Thread", | ||
"fields":[{"name":"threadLocalRandomProbe"}] | ||
}, | ||
{ | ||
"name":"java.net.Socket", | ||
"methods":[{"name":"setOption","parameterTypes":["java.net.SocketOption","java.lang.Object"] }] | ||
}, | ||
{ | ||
"name":"java.security.SecureRandomParameters" | ||
}, | ||
{ | ||
"name":"java.util.concurrent.ForkJoinTask", | ||
"fields":[{"name":"aux"}, {"name":"status"}] | ||
}, | ||
{ | ||
"name":"java.util.concurrent.atomic.Striped64", | ||
"fields":[{"name":"base"}, {"name":"cellsBusy"}] | ||
}, | ||
{ | ||
"name":"jdk.internal.misc.Unsafe" | ||
}, | ||
{ | ||
"name":"jdk.net.ExtendedSocketOptions", | ||
"fields":[{"name":"TCP_KEEPCOUNT"}, {"name":"TCP_KEEPIDLE"}, {"name":"TCP_KEEPINTERVAL"}] | ||
}, | ||
{ | ||
"name":"org.bson.codecs.kotlin.DataClassCodecProvider" | ||
}, | ||
{ | ||
"name":"org.bson.codecs.kotlinx.KotlinSerializerCodecProvider" | ||
}, | ||
{ | ||
"name":"org.bson.codecs.record.RecordCodecProvider" | ||
}, | ||
{ | ||
"name":"org.slf4j.Logger" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2008-present MongoDB, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.mongodb.internal.graalvm; | ||
|
||
import com.mongodb.internal.dns.JndiDnsClient; | ||
import com.mongodb.spi.dns.DnsClient; | ||
import com.mongodb.spi.dns.DnsClientProvider; | ||
import com.mongodb.spi.dns.DnsException; | ||
|
||
import java.util.List; | ||
|
||
import static java.lang.String.format; | ||
|
||
public final class CustomDnsClientProvider implements DnsClientProvider { | ||
private static volatile boolean used = false; | ||
|
||
public CustomDnsClientProvider() { | ||
} | ||
|
||
@Override | ||
public DnsClient create() { | ||
return new CustomDnsClient(); | ||
} | ||
|
||
static void assertUsed() throws AssertionError { | ||
if (!used) { | ||
throw new AssertionError(format("%s is not used", CustomDnsClientProvider.class.getSimpleName())); | ||
} | ||
} | ||
|
||
private static void markUsed() { | ||
used = true; | ||
} | ||
|
||
private static final class CustomDnsClient implements DnsClient { | ||
private final JndiDnsClient wrapped; | ||
|
||
CustomDnsClient() { | ||
wrapped = new JndiDnsClient(); | ||
} | ||
|
||
@Override | ||
public List<String> getResourceRecordData(final String name, final String type) throws DnsException { | ||
markUsed(); | ||
return wrapped.getResourceRecordData(name, type); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.