File tree Expand file tree Collapse file tree 8 files changed +448
-0
lines changed
main/java/com/ibm/cldk/entities
test/resources/test-applications/init-blocks-test
app/src/main/java/org/example Expand file tree Collapse file tree 8 files changed +448
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 1+ # Ignore Gradle project-specific cache directory
2+ .gradle
3+
4+ # Ignore Gradle build output directory
5+ build
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments