Did you forget the def keyword? With custom classes

XMLWordPrintable

    • Type: Bug
    • Resolution: Not A Defect
    • Priority: Minor
    • Component/s: workflow-cps-plugin
    • None

      Hello,

      in my shared library I use utility classes like 'AWSUtils' to consolidate AWS related code into a single spot.
      When I then try to use said code, by first creating an object of the class like this:

      AWSUtils awsUtils = new AWSUtils(steps) 

      the jenkins pipline throws me the usualĀ 
      "Did you forget the `def` keyword? setupStage seems to be setting a field named awsUtils (to a value of type AWSUtils) which could lead to memory leaks or other issues."
      warning.
      The whole code runs within the shared library, with the jenkinsfile only calling the shared library function with some basic parameters like customer and stage.

      The utility classes are properly imported and work perfectly fine, but since I utilize quite some amount of utility classes, my output is semi-flooded with these warnings, which I want to avoid.

      EDIT: when i create the class object by usingĀ  'def', the warning (obviously) isn't present. Since the warning can resolve the type, i don't understand, why it doesn't recognize it the same as when native classes are used.

            Assignee:
            Unassigned
            Reporter:
            Daniel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: