Skip to content

Commit 01d0789

Browse files
committed
#46 - Fix NoSuchMethodError
1 parent 34f7aa6 commit 01d0789

File tree

9 files changed

+49
-8
lines changed

9 files changed

+49
-8
lines changed

Diff for: CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Before merge all items in the DoD must be done:
5656
- You can then open it in two ways:
5757
- The repository contains Eclipse's .project file, therefore you can open it with Eclipse -> File -> Open project from File System -> select the folder
5858
- Alternatively you can import it via File -> Import -> Plugin Development -> Plugins and Fragments -> choose the correct directory and add the plugins
59+
- Set the active platform to be Neon (this can be done by open sparkbuildergenerator.target and click on "Set as active platform" or by setting it in Eclipse preferences "Target platform menu")
5960

6061
### Running the project
6162

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Most configuration is on the preferences page: Preferences -> Java -> Spark buil
105105
- 0.0.19
106106
Fixed ClassCastException when Java file includes an enum as the first type.
107107
JsonPOJOBuilder annotation is not generated when the default builder names is not overridden
108+
- 0.0.20
109+
Fixed regression issue caused by wrong target definition on compiling
108110

109111
## The generated code looks like the following:
110112

Diff for: SparkBuilderGeneratorPlugin/META-INF/MANIFEST.MF

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: SparkBuilderGenerator
44
Bundle-SymbolicName: com.helospark.SparkBuilderGenerator;singleton:=true
5-
Bundle-Version: 0.0.19.qualifier
5+
Bundle-Version: 0.0.20.qualifier
66
Bundle-ClassPath: .
77
Bundle-Activator: com.helospark.spark.builder.Activator
88
Require-Bundle: org.eclipse.ui,

Diff for: SparkBuilderGeneratorPlugin/SparkBuilderGeneratorFeature/feature.xml

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="com.helospark.SparkBuilderGeneratorFeature"
44
label="SparkBuilderGeneratorFeature"
5-
version="0.0.19.qualifier">
5+
version="0.0.20.qualifier">
66

77
<description url="ftp://helospark.com/SparkBuilderGeneratorPlugin/">
88
Spark builder generator plugin
@@ -59,9 +59,13 @@ Generate public default constructor
5959
- 0.0.18
6060
Fixed dialog issue when combined with DevStyle Darkest Dark plugin,
6161
also made dialogs more responsive and updated icon
62-
- 0.0.19
63-
Fixed ClassCastException when Java file includes an enum as the first type.
64-
JsonPOJOBuilder annotation is not generated when the default builder names is not overridden
62+
- 0.0.19
63+
Fixed ClassCastException when Java file includes an enum as the
64+
first type.
65+
JsonPOJOBuilder annotation is not generated when the default
66+
builder names is not overridden
67+
- 0.0.20
68+
Fixed regression issue caused by wrong target definition on compiling
6569
</description>
6670

6771
<license url="https://opensource.org/licenses/MIT">

Diff for: SparkBuilderGeneratorPlugin/SparkBuilderGeneratorUpdateSite/site.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<description name="Spark builder generator plugin" url="ftp://helospark.com/eclipse_plugin/SparkBuilderGeneratorPlugin/">
44
Plugin to generate builder
55
</description>
6-
<feature url="features/com.helospark.SparkBuilderGeneratorFeature_0.0.19.201810182013.jar" id="com.helospark.SparkBuilderGeneratorFeature" version="0.0.19.201810182013">
6+
<feature url="features/com.helospark.SparkBuilderGeneratorFeature_0.0.20.201811262151.jar" id="com.helospark.SparkBuilderGeneratorFeature" version="0.0.20.201811262151">
77
<category name="SparkTools"/>
88
</feature>
99
<category-def name="SparkTools" label="SparkTools"/>
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="sparkbuildergenerator">
2+
<locations>
3+
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
4+
<unit id="org.eclipse.jdt.feature.group" version="3.12.3.v20170301-0400"/>
5+
<unit id="org.eclipse.jdt.source.feature.group" version="3.12.3.v20170301-0400"/>
6+
<unit id="org.eclipse.pde.feature.group" version="3.12.3.v20170301-0400"/>
7+
<unit id="org.eclipse.pde.source.feature.group" version="3.12.3.v20170301-0400"/>
8+
<unit id="org.eclipse.platform.ide" version="4.6.3.M20170301-0400"/>
9+
<unit id="org.eclipse.platform.sdk" version="4.6.3.M20170301-0400"/>
10+
<unit id="org.eclipse.sdk.ide" version="4.6.3.M20170301-0400"/>
11+
<repository location="http://download.eclipse.org/eclipse/updates/4.6"/>
12+
</location>
13+
</locations>
14+
</target>

Diff for: SparkBuilderGeneratorPlugin/src/com/helospark/spark/builder/handlers/ErrorHandlerHook.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void onPluginException(PluginException e) {
2626
pluginLogger.warn(e.getMessage(), e);
2727
}
2828

29-
public void onUnexpectedException(Exception e) {
29+
public void onUnexpectedException(Throwable e) {
3030
dialogWrapper.openErrorDialogWithStacktrace(ERROR_TITLE,
3131
UNEXPECTED_ERROR_MESSAGE, e);
3232
pluginLogger.error(UNEXPECTED_ERROR_MESSAGE, e);

Diff for: SparkBuilderGeneratorPlugin/src/com/helospark/spark/builder/handlers/GenerateBuilderHandlerErrorHandlerDecorator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void execute(ExecutionEvent event, BuilderType builderType) throws Execut
2525
generateBuilderHandlerDelegate.execute(event, builderType);
2626
} catch (PluginException e) {
2727
errorHandlerHook.onPluginException(e);
28-
} catch (Exception e) {
28+
} catch (Throwable e) {
2929
errorHandlerHook.onUnexpectedException(e);
3030
throw new RuntimeException(e.getMessage(), e);
3131
}

Diff for: SparkBuilderGeneratorPlugin/test/com/helospark/spark/builder/handlers/it/ExceptionFlowE2ETest.java

+20
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,24 @@ public void testWhenUnexpectedExceptionOccurresShouldShowErrorDialog() throws Ex
107107
"This error should not have happened!\nYou can create an issue on https://github.com/helospark/SparkTools with the below stacktrace",
108108
unexpectedException);
109109
}
110+
111+
@Test
112+
public void testWhenUnexpectedErrorOccurresShouldShowErrorDialog() throws Exception {
113+
// GIVEN
114+
NoSuchMethodError unexpectedException = new NoSuchMethodError("Cause");
115+
willThrow(unexpectedException)
116+
.given(regularBuilderCompilationUnitGenerator)
117+
.generateBuilder(any(CompilationUnitModificationDomain.class));
118+
super.setInput("class TestClass {}");
119+
120+
// WHEN
121+
try {
122+
underTest.execute(dummyExecutionEvent);
123+
} catch (Exception e) {
124+
}
125+
// THEN
126+
verify(dialogWrapper).openErrorDialogWithStacktrace("Error",
127+
"This error should not have happened!\nYou can create an issue on https://github.com/helospark/SparkTools with the below stacktrace",
128+
unexpectedException);
129+
}
110130
}

0 commit comments

Comments
 (0)