Skip to content

Commit cd6adb9

Browse files
committed
Issue 103: Add a test application and a InitializationBlock entity.
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
1 parent 7fb8148 commit cd6adb9

File tree

8 files changed

+448
-0
lines changed

8 files changed

+448
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.ibm.cldk.entities;
2+
3+
import lombok.Data;
4+
5+
import java.util.List;
6+
7+
@Data
8+
public class InitializationBlock {
9+
private String filePath;
10+
private String comment;
11+
private List<String> annotations;
12+
private List<String> thrownExceptions;
13+
private String code;
14+
private int startLine;
15+
private int endLine;
16+
private boolean isStatic;
17+
private List<String> referencedTypes;
18+
private List<String> accessedFields;
19+
private List<CallSite> callSites;
20+
private List<VariableDeclaration> variableDeclarations;
21+
private int cyclomaticComplexity;
22+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary
12+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.example;
2+
3+
import java.util.List;
4+
5+
public class App {
6+
private static String staticMessage;
7+
8+
static {
9+
try {
10+
staticMessage = "Static block initialized";
11+
System.out.println("Static initialization block executed.");
12+
initializeStaticFields();
13+
} catch (Exception e) {
14+
System.err.println("Error in static block: " + e.getMessage());
15+
}
16+
}
17+
18+
{
19+
try {
20+
System.out.println("Instance initialization block executed.");
21+
initializeInstanceFields();
22+
} catch (Exception e) {
23+
System.err.println("Error in instance block: " + e.getMessage());
24+
}
25+
}
26+
27+
public App() {
28+
System.out.println("Constructor executed.");
29+
}
30+
31+
private static void initializeStaticFields() {
32+
System.out.println("Initializing static fields.");
33+
}
34+
35+
private void initializeInstanceFields() {
36+
System.out.println("Initializing instance fields.");
37+
}
38+
39+
public static void main(String[] args) {
40+
new App();
41+
}
42+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.configuration-cache=true
5+
org.gradle.parallel=true
6+
org.gradle.caching=true
7+

src/test/resources/test-applications/init-blocks-test/gradlew

Lines changed: 251 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)