This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch camel-master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-master by this push: new a5b731f Fix camel-quarkus-bean according to changes in camel 3.1.0 a5b731f is described below commit a5b731f251455452c23b38a0c4f5e9a040548faf Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Mon Feb 24 09:44:10 2020 +0100 Fix camel-quarkus-bean according to changes in camel 3.1.0 --- .../component/bean/graal/ExcludeMethodList.java | 72 ---------------------- .../component/bean/graal/SubstituteBeanInfo.java | 32 ---------- 2 files changed, 104 deletions(-) diff --git a/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/ExcludeMethodList.java b/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/ExcludeMethodList.java deleted file mode 100644 index 353006a..0000000 --- a/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/ExcludeMethodList.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.camel.quarkus.component.bean.graal; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Proxy; -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * This is a workaround for https://github.com/oracle/graal/issues/1971. An instance of lazily initialized list is set - * to {@code org.apache.camel.component.bean.BeanInfo.EXCLUDED_METHODS}. - * - * @see SubstituteBeanInfo - */ -class ExcludeMethodList extends AbstractList<Method> { - - private volatile List<Method> delegate; - - @Override - public Method get(int index) { - return delegate().get(index); - } - - @Override - public int size() { - return delegate().size(); - } - - List<Method> delegate() { - if (delegate == null) { - synchronized (this) { - if (delegate == null) { - // The logic is taken from the static initializer of BeanInfo - delegate = new ArrayList<>(); - // exclude all java.lang.Object methods as we dont want to invoke them - delegate.addAll(Arrays.asList(Object.class.getDeclaredMethods())); - // exclude all java.lang.reflect.Proxy methods as we dont want to invoke them - delegate.addAll(Arrays.asList(Proxy.class.getDeclaredMethods())); - // Remove private methods - delegate.removeIf(m -> Modifier.isPrivate(m.getModifiers())); - try { - // but keep toString as this method is okay - delegate.remove(Object.class.getDeclaredMethod("toString")); - delegate.remove(Proxy.class.getDeclaredMethod("toString")); - } catch (Throwable e) { - // ignore - } - } - } - } - return delegate; - } - -} diff --git a/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/SubstituteBeanInfo.java b/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/SubstituteBeanInfo.java deleted file mode 100644 index ff966f4..0000000 --- a/extensions/bean/runtime/src/main/java/org/apache/camel/quarkus/component/bean/graal/SubstituteBeanInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.camel.quarkus.component.bean.graal; - -import java.lang.reflect.Method; -import java.util.List; - -import com.oracle.svm.core.annotate.Alias; -import com.oracle.svm.core.annotate.RecomputeFieldValue; -import com.oracle.svm.core.annotate.TargetClass; - -@TargetClass(className = "org.apache.camel.component.bean.BeanInfo") -final class SubstituteBeanInfo { - - @Alias - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClass = ExcludeMethodList.class) - private static List<Method> EXCLUDED_METHODS; -}