|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2011, 2025 Google, Inc. and others. |
| 2 | + * Copyright (c) 2011, 2026 Google, Inc. and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials are made available under the |
5 | 5 | * terms of the Eclipse Public License 2.0 which is available at |
|
28 | 28 | import org.eclipse.wb.internal.core.utils.ast.AstEditor; |
29 | 29 | import org.eclipse.wb.internal.core.utils.ast.AstNodeUtils; |
30 | 30 | import org.eclipse.wb.internal.core.utils.check.Assert; |
| 31 | +import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils; |
31 | 32 | import org.eclipse.wb.internal.core.utils.execution.RunnableEx; |
32 | 33 | import org.eclipse.wb.internal.rcp.IExceptionConstants; |
33 | 34 | import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; |
|
43 | 44 | import net.bytebuddy.ByteBuddy; |
44 | 45 | import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; |
45 | 46 |
|
| 47 | +import java.lang.invoke.MethodHandles; |
46 | 48 | import java.util.List; |
47 | 49 | import java.util.Objects; |
48 | 50 |
|
@@ -196,11 +198,14 @@ public static Class<?> getNotAbstractDialog(ClassLoader classLoader) |
196 | 198 | try { |
197 | 199 | return classLoader.loadClass("org.eclipse.swt.widgets.Dialog_"); |
198 | 200 | } catch (ClassNotFoundException e) { |
| 201 | + Class<?> clazz = classLoader.loadClass("org.eclipse.swt.widgets.Dialog"); |
| 202 | + MethodHandles.Lookup lookup = ExecutionUtils |
| 203 | + .runObject(() -> MethodHandles.privateLookupIn(clazz, MethodHandles.lookup())); |
199 | 204 | return new ByteBuddy() |
200 | 205 | .subclass(classLoader.loadClass("org.eclipse.swt.widgets.Dialog")) // |
201 | 206 | .name("org.eclipse.swt.widgets.Dialog_") // |
202 | 207 | .make() // We have to use injection to load the class in the CreationSupport |
203 | | - .load(classLoader, ClassLoadingStrategy.Default.INJECTION) // |
| 208 | + .load(classLoader, ClassLoadingStrategy.UsingLookup.of(lookup)) // |
204 | 209 | .getLoaded(); |
205 | 210 | } |
206 | 211 | } |
|
0 commit comments