From 7a6e311147835a85d1af0dadb14767b45a3c9570 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Thu, 11 Jul 2019 15:05:49 -0700 Subject: [PATCH] Fix bug that breaks live hover to tunneled cf apps Also add a regression test that would have caught this issue. --- .../boot/app/cli/RemoteSpringBootAppTest.java | 27 +++++++++++++++++++ .../vscode/commons/util/MemoizingProxy.java | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java new file mode 100644 index 000000000..a1841995b --- /dev/null +++ b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2018, 2019 Pivotal, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.commons.boot.app.cli; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class RemoteSpringBootAppTest { + + @Test + public void canCreateInstance() throws Exception { + SpringBootApp instance = RemoteSpringBootApp.create("jmx:blah", "whatever.cfapps.io", "8888", "https", true); + assertNotNull(instance); + assertTrue(instance instanceof RemoteSpringBootApp); + } + +} diff --git a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/MemoizingProxy.java b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/MemoizingProxy.java index 7ec97e1b8..0e586083f 100644 --- a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/MemoizingProxy.java +++ b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/MemoizingProxy.java @@ -198,7 +198,7 @@ public class MemoizingProxy { .defineField(F_CACHE, Cache.class, Opcodes.ACC_PRIVATE) .method(CACHABLE_METHODS).intercept(MethodDelegation.to(SuperMethodInterceptor.class)) .defineConstructor(Visibility.PUBLIC).withParameters(argTypes).intercept( - MethodCall.invoke(klass.getConstructor(argTypes)).withAllArguments() + MethodCall.invoke(klass.getDeclaredConstructor(argTypes)).withAllArguments() .andThen(METHOD_DELEGATION.to(ClassConstructorInterceptor.class)) );