From fd1e35aaa194d8f471ec66e2295c5e66f59b6afd Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 9 Mar 2022 12:07:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=97=A0JIRA=E9=A1=B9=E7=9B=AE=20=E5=AF=B9?= =?UTF-8?q?Install4j=E6=96=B9=E6=B3=95=E7=9A=84=E8=B0=83=E7=94=A8=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E6=94=B9=E7=94=A8=E5=8F=8D=E5=B0=84=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=87=BA=E7=8E=B0=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 考核同学使用starter项目,无法进行正常编译,出现类和方法调用异常。 一方面是starter项目没有配置对intall4j的编译依赖导致,另一方面是主jar中 对install4j API的使用没有反射导致 【改动思路】 改用反射方式调用Install4J相关API 【review建议】 --- .../Install4jStartupNotificationProvider.java | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java index dbc7be2b72..5402032f94 100644 --- a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java +++ b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java @@ -1,6 +1,10 @@ package com.fr.design.startup; -import com.install4j.api.launcher.StartupNotification; +import com.fr.invoke.Reflect; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; /** * @author Starryi @@ -18,18 +22,30 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica @Override public void registerStartupListener(Listener listener) { - boolean supported = false; - try { - supported = Class.forName("com.install4j.api.launcher.StartupNotification") != null; - } catch (Throwable ignored) {} - - if (supported) { - StartupNotification.registerStartupListener(new StartupNotification.Listener() { - @Override - public void startupPerformed(String parameters) { - listener.startupPerformed(parameters); - } - }); + Class StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + if (StartupNotificationListenerClass == null) { + return; + } + + ListenerHandler mHandler = new ListenerHandler(listener); + Object listenerCallbackInstance = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { StartupNotificationListenerClass }, mHandler); + Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + } + + private static class ListenerHandler implements InvocationHandler { + private final Listener listener; + + public ListenerHandler(Listener listener) { + this.listener = listener; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (args[0] instanceof String) { + String parameters = (String) args[0]; + listener.startupPerformed(parameters); + } + return null; } } } From 6394044df6f4f02d3cd61bbecb523de468acbe0a Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 10 Mar 2022 16:41:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-67329=20=E5=A1=AB=E6=8A=A5-web?= =?UTF-8?q?=E7=AB=AF=E9=A2=84=E8=A7=88-10=E5=8D=87=E7=BA=A711=EF=BC=8C?= =?UTF-8?q?=E9=80=8F=E6=98=8E=E7=9A=84=E7=BA=B8=E5=BC=A0=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=8F=98=E6=88=90=E4=BA=86=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/ReportBackgroundSpecialPane.java | 2 +- .../backgroundpane/ColorBackgroundQuickPane.java | 9 ++++++--- .../fr/design/style/color/NewColorSelectBox.java | 13 ++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java b/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java index aeb2938a27..257e090c20 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/ReportBackgroundSpecialPane.java @@ -29,7 +29,7 @@ public class ReportBackgroundSpecialPane extends BackgroundPane { protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { NullBackgroundQuickPane nullBackgroundPane = new NullBackgroundQuickPane(); - ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane(); + ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane(true); colorBackgroundPane.registerChangeListener(new UIObserverListener() { @Override public void doChange() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java index 9d9eb0058c..086a07da48 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java @@ -16,10 +16,9 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { private NewColorSelectBox colorSelectBox; - - public ColorBackgroundQuickPane() { + public ColorBackgroundQuickPane(boolean supportTransparent) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - colorSelectBox = new NewColorSelectBox(100) { + colorSelectBox = new NewColorSelectBox(100, supportTransparent) { @Override public boolean shouldResponseChangeListener() { // ColorBackgroundQuickPane注册监听器ChangeListenerImpl的逻辑不能丢,因为里面有修改字段backgroundChange的逻辑. @@ -33,6 +32,10 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { this.add(colorSelectBox, BorderLayout.NORTH); } + public ColorBackgroundQuickPane() { + this(false); + } + public void populateBean(Background background) { ColorBackground colorBackgroud = (ColorBackground) background; populateColor(colorBackgroud.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java index 04d368e6bc..59ef1e6e43 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java @@ -20,13 +20,20 @@ public class NewColorSelectBox extends AbstractSelectBox implements UIObs private static final long serialVersionUID = 2782150678943960557L; private Color color; - private NewColorSelectPane colorPane = new NewColorSelectPane(false); + private NewColorSelectPane colorPane; private UIObserverListener uiObserverListener; private String newColorSelectBoxName = ""; private GlobalNameListener globalNameListener = null; + private boolean supportTransparent; public NewColorSelectBox(int preferredWidth) { - initBox(preferredWidth); + this(preferredWidth, false); + } + + public NewColorSelectBox(int preferredWidth, boolean supportTransparent) { + this.colorPane = new NewColorSelectPane(supportTransparent); + this.supportTransparent = supportTransparent; + initBox(preferredWidth); iniListener(); } @@ -58,7 +65,7 @@ public class NewColorSelectBox extends AbstractSelectBox implements UIObs */ public JPanel initWindowPane(double preferredWidth) { // 下拉的时候重新生成面板,以刷新最近使用颜色 - colorPane = new NewColorSelectPane(false); + colorPane = new NewColorSelectPane(this.supportTransparent); colorPane.setColor(this.getSelectObject()); colorPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { From 6b00e6e9591403aea2794b586b37877646f70571 Mon Sep 17 00:00:00 2001 From: Bryant Date: Fri, 11 Mar 2022 09:25:30 +0800 Subject: [PATCH 3/3] Update designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java --- .../com/fr/design/record/analyzer/advice/MonitorAdvice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java b/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java index 9c5d72668a..523e18249b 100644 --- a/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java +++ b/designer-base/src/main/java/com/fr/design/record/analyzer/advice/MonitorAdvice.java @@ -37,7 +37,7 @@ public class MonitorAdvice implements DesignerAnalyzerAdvice { private static final Pattern P = Pattern.compile("-?\\d+"); private static final int MIN_ERROR_CODE = 10000000; - private static ExecutorService executorService = FineExecutors.newCachedThreadPool(new + public static ExecutorService executorService = FineExecutors.newCachedThreadPool(new NamedThreadFactory(MonitorAdvice.class)); @Advice.OnMethodEnter