Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.dynalink/share/classes/jdk/dynalink/beans/LinkerServicesWithMissingMemberHandlerFactory.java
41161 views
1
/*
2
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package jdk.dynalink.beans;
27
28
import java.lang.invoke.MethodHandle;
29
import java.lang.invoke.MethodType;
30
import java.util.function.Supplier;
31
import jdk.dynalink.SecureLookupSupplier;
32
import jdk.dynalink.linker.ConversionComparator.Comparison;
33
import jdk.dynalink.linker.GuardedInvocation;
34
import jdk.dynalink.linker.LinkRequest;
35
import jdk.dynalink.linker.LinkerServices;
36
37
final class LinkerServicesWithMissingMemberHandlerFactory implements LinkerServices {
38
final LinkerServices linkerServices;
39
final MissingMemberHandlerFactory missingMemberHandlerFactory;
40
41
static LinkerServices get(final LinkerServices linkerServices, final MissingMemberHandlerFactory missingMemberHandlerFactory) {
42
if (missingMemberHandlerFactory == null) {
43
return linkerServices;
44
}
45
return new LinkerServicesWithMissingMemberHandlerFactory(linkerServices, missingMemberHandlerFactory);
46
}
47
48
private LinkerServicesWithMissingMemberHandlerFactory(final LinkerServices linkerServices, final MissingMemberHandlerFactory missingMemberHandlerFactory) {
49
this.linkerServices = linkerServices;
50
this.missingMemberHandlerFactory = missingMemberHandlerFactory;
51
}
52
53
@Override
54
public MethodHandle asType(final MethodHandle handle, final MethodType fromType) {
55
return linkerServices.asType(handle, fromType);
56
}
57
58
@Override
59
public MethodHandle getTypeConverter(final Class<?> sourceType, final Class<?> targetType) {
60
return linkerServices.getTypeConverter(sourceType, targetType);
61
}
62
63
@Override
64
public boolean canConvert(final Class<?> from, final Class<?> to) {
65
return linkerServices.canConvert(from, to);
66
}
67
68
@Override
69
public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest) throws Exception {
70
return linkerServices.getGuardedInvocation(linkRequest);
71
}
72
73
@Override
74
public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
75
return linkerServices.compareConversion(sourceType, targetType1, targetType2);
76
}
77
78
@Override
79
public MethodHandle filterInternalObjects(final MethodHandle target) {
80
return linkerServices.filterInternalObjects(target);
81
}
82
83
@Override
84
public <T> T getWithLookup(final Supplier<T> operation, final SecureLookupSupplier lookupSupplier) {
85
return linkerServices.getWithLookup(operation, lookupSupplier);
86
}
87
}
88
89