How to import another class in Jira script editor in order to call a function declared in this class - jira

Anyone knows how to import another class in Script Editor of Jira. I receive the following error:
Although the file exists as you can see in the following screenshot:

Related

Vaadin 23 cannot handle #Viewport annotation

I have upgraded a Vaadin 14 app to Vaadin 23.1.3 and now it refuses to start with this error message:
Found app shell configuration annotations in non `AppShellConfigurator` classes.
Please create a custom class implementing `AppShellConfigurator` and move the following annotations to it:
- #Viewport from my.custom.class
However, my class does not have this annotation, it only extends an abstract class with this annoation. But I cannot change the abstract class, because it is a third party lib. So is there a way to tell Vaadin to just ignore this annotation and use the one I provided in the AppShellConfigurator class? Or any other way to get this app to start short of ditching the 3rd party library?
If the problematic class is just an abstract one, You can try creating a custom class with exactly the same structure and name but without the Viewport annotation. Then just import your custom class instead of the one from external package.
For example while using the AppLayoutRouterLayout class from com.github.appreciated:app-layout-addon package You could replace its usage with following class:
import com.github.appreciated.app.layout.component.applayout.AppLayout;
import com.github.appreciated.app.layout.component.router.AppLayoutRouterLayoutBase;
public abstract class AppLayoutRouterLayout<T extends AppLayout> extends AppLayoutRouterLayoutBase<T> {
}

How to avoid writing an import for every single file in dart/flutter?

I am making a flutter application and I created a file/class for each custom widget I am using. Then, I imported all of these files into the main screen but I don't like how it looks. Especially because if I want to add another widget or delete the one I would need to fiddle with the imports.
Is there something like C# namespaces where I can just make one import for all files in folder/namespace?
I already tried using library/part with success but then in https://www.dartlang.org/guides/libraries/create-library-packages says that I should avoid using part/part of. So, are we expected to import each and every file?
Instead of having:
import 'package:custom_widgets/custom_multiplechoice.dart';
import 'package:custom_widgets/custom_singlechoice.dart';
import 'package:custom_widgets/custom_time.dart';
import 'package:custom_widgets/custom_yesnochoice.dart';
import 'package:custom_widgets/custom_date.dart';
I would like to have:
import 'package:custom_widgets';
Yes there is, you can use export to achieve what you want.
You can place all your widgets in a folder, for example libs/src/ and then create file custom_widgets.dart in libs/ and use export like this inside custom_widgets.dart:
export 'src/custom_multiplechoice.dart';
export 'src/custom_singlechoice.dart';
export 'src/custom_time.dart';
export 'src/custom_widgets/src/custom_yesnochoice.dart';
export 'src/custom_date.dart';
Once you import custom_widgets.dart, all those widgets will be available to you.
Check this out, its all explained here: Dart: Organizing a library package
Update:
In Dart there are no namespaces like in most other languages.
Dart uses libraries for encapsulation, data hiding.
Only way to import a class into your code is to use import in the beginning of your file, which should also be a library.
I have an issue with this too. Imagine a situation where you want to import library dynamically. Let's say you would like to implement MVC pattern in your application, if you are doing this on the server, you would have a Router class that would analyze URL and decide what Controller class to instantiate and what Method from that Controller to invoke. Now every URL would trigger different Controller, and you don't know it in advance, its up to your Router to detect a Class to instantiate. What you need to do in this situation is import every Controller that could get instantiated at the beginning of your file. And I have issues with that. What if your application gets big and you have to import lets say 20 Controller classes, just so Router / Dispatcher can invoke one of them, and in reality you will invoke only one Controller, as there is only Controller per URL.
Don't have issues with manual loading of Libraries, if they are going to be used, but for situation like described above, Dart fails as there is no "auto loading" of classes like in for example PHP, where you can use auto loaders that use namespaces to find out about location of your class and instantiate a class in the middle of the code dynamically.
There is this extension for VSCode which can help to create this.
Dart Barrel File Generator

library Jenkins Step is not working to dynamically load methods

I want to create a new instance of a class which is in src folder in my shared library. Of cource I can do a simple def object = new myClass() with an import on the top but I want to do it dynamically initiate classes (trying to use Class.forName failed for me and I'm not going to use that solution).
I'm trying to do this from a groovy file which is under vars folder and not src.
So what I do is : def customized = library("mySharedLib").com.x.x.MyClass.new(this)
As it is specified in the documentation for Shared libraries : Step library
But I'm getting the error :
java.lang.IllegalAccessException: com.x.x.MyClass was defined in file:///Path/to/master/workspace/jobs/project/builds/297/libs/mySharedLib/vars/generic.groovy which was not inside file:///Path/to/master/workspace/jobs/project/branches/PR-50/builds/297/libs/mySharedLib/src/
In the Jenkins Jira Here, there is the same issue... any ideas ?? I can't understand wht is going on! I tried making a method in a class under src folder that does the step library call but it returns same error.
No need to load the library from within the vars folder (I assume it’s in the same repository like the src folder). Simply import the class with a plain import and use it like in plain groovy, e.g.
import org.pack.Myclass
def call() {
def myClass = new MyClass()
}

grails 2.5+ Duplicate class definition error when implementing serializable on a controller

Upgrading a legacy system of grails. One of the controllers implements Serializable. This is throwing the following error in newer versions of grails:
Invalid duplicate class definition of class com.regional.ScheduleController :
The source contains at least two definitions of the class.
One of the classes is an explicit generated class using the class statement,
the other is a class generated from the script body based on the file name.
Solutions are to change the file name or to change the class name.
The solution mentioned would break (previous) grails convention. Anyone know how to handle this in grails 2.5+?
EDIT
Serializable is not the issue. I tried removing it and got the same error.
I found this explanation from another question:
IN groovy.. class B{} is a class structure and defines a class B.
Scripts are classes too.
Now you may create a B.groovy, with the content "class B{}; def b = new B()".
There would be one class named B, and a script with the very same name.
This is a conflict.
However this does not explain why it runs fine below grails 2.5 and not above it. And I can't find a def conflict like the one mentioned above in that controller.
ANSWER:
One of the imports was what was actually failing- in a way that caused groovy to generate a class definition based on the current file name. When it hit the class definition, there was already an auto generated class name to collide with.

Import class from an inplacePlugin to another inplacePlugin Grails

I need use a domain class define in one inplacePlugin to a controller class in another inplacePlugin inside my app, but when I try to define the class IDE "cannot resolve the symbol". AutorDef domain class I define public in my app. What i need to do for reselve this issue?
def autor = AutorDef.findAll()
I already know how can do it that, it is very simple, (of course after a few day of deep thinking and search). Here is the solution.
In BuildConfig.groovy inside the inplace plugin where we need import the domain class from other inplace plugin we add next code,
grails.plugin.location.'common'="../sdl-common"
We add this code directly below
grails.project.test.reports.dir = "target/test-reports"
The import code before equals
grails.plugin.location.'common'
is the name use for import the plugin data(domain class, etc) and
"../sdl-common"
is the route to inplace plugin, and when we need to import the data in our classes, or controllers, we only need add
import common.*
in the part where we import hte packages.

Resources