Intellij issue with "Command" groovy class - intellij-idea

I have a grails domain class called "Command.groovy", which isn't being picked up by intellij as a domain class, for any and all purposes (such as highlighting that class or importing it in files, it says it's not found).
However, my code still compiles and works.
I tried looking online about this issue but haven't found anything about this.

Thanks #CrazyCoder, I found the answer where you mentioned.
The problem was the file was mapped to auto detect file type by content for some reason. (Found in settings->file types->Auto-detect file by content)

Related

Intellij "Find in Path" only has results for `Directory` but not Project, Module or Scope

As shown in the screenshot the current file has multiple instances of splice. However the Find in Path dialog does not find even those ones - let alone the many instances in other project files.
I also tried the Module and Scope : none find anything. However the Directory has the following:
So What is going on with the In Project, Module and Scope options?
Thanks to the suggestion by #Andrey this is now being tracked at https://youtrack.jetbrains.com/issue/IDEA-244685 .

IntelliJ does not recognize kotlin file after deleting it and recreate with the same name

I am currently having a problem with IntelliJ. I am using Kotlin in my project. I have deleted a file (let's say test.kt), and now, I want to create a new file with the same name. IntelliJ does not recognize the kotlin syntaxe and show it as a text file.
When I have deleted I have unchecked "safe delete" and "Search in comment and strings"
Can anyone help me in this matter ?
Edit : I tried to delete .idea and .iml file, restart intelliJ. It does not change anything.
"Overrid File Type" to Kotlin would work.
Expanding on a comment:
Is test.kt listed in Preferences > Editor > File Types > Text, under the Registered Patterns? An entry there may override the default Kotlin filetype
I had a class, MyProxy.kt, that as the question implies was not being picked up as a Kotlin class in IntelliJ. I scrolled through my list of file associations and did not find anything that could match MyProxy.kt except for the Kotlin extension, *.kt (it is entirely possible I missed something.)
Most regex matching will apply the most specific rule, though. On the off chance my class was being picked up by another association, I explicitly declared it as a Kotlin file pattern. It is a little hacky, but it did work! My Kotlin file name patterns are now:
*.kt
*.kts
*.main.kts
MyProxy.kt
Note: IntelliJ did complain that *.kt would already catch MyProxy.kt, but I overrode it.
Ctrl+alt+s, Editor, File Types, under recognized filetypes,
Under Filetype auto-detected by file content...
remove Main.kt

IntelliJ autocomplete partially working

I've just added some Java classes to my project in IntelliJ IDEA 2017.2.3. When I attempt to use autocomplete to add the elsewhere in the project, it does not find them. It shows older classes, but not the new classes. If I type out the class name, IntelliJ asks to import it and everything works.
What am I missing? Why would if find some of my classes and not others?
Not the end of the world, but it is very annoying.
Well, I just discovered the invalidate cache option. This appears to have fixed the issue, by forcing a re-index.
For anyone else facing this problem, the option is under File -> Invalidate Caches / Restart...

Can't get PDFBox CreatePDFA example to work - Color profile not found

I'm trying to get the example for creating a PDF/A document with Apache PDFBox up an running (CreatePDFA.java).
For this I copied the example class as is into a project module that includes a maven-dependency on PDFBox in version 2.0.0-RC3. I only changed the method signature and used a fixed font, filename and message instead of args[].
When trying to run the code I get an NPE in Line 107 because it cant't load the color profile (InputStream is null) When I check the included library in the project details I can see the resources folder, but it does not contain the expected file, namely "pdfa/sRGB Color Space Profile.icm".
Unfortunately, google-ing the problem only turned up more references to always the same example implementation, but after a while I acutally found what seems to be the needed file on apache.googlesource.com
I copied the file to our own resource directory and then used this line of code instead:
InputStream colorProfile = CreatePdfA.class.getResourceAsStream("/pdfa/sRGB Color Space Profile.icm");
This finally stopped the NPE - the file is apparently found - but now I get another exception which says:
java.lang.IllegalArgumentException: Invalid ICC Profile Data
Here, I'm stuck. I had hoped that this would work just out of the box, but it seems like I am missing something. Any ideas?
You already answered one part of the problem yourself: put the file into your resource directory.
The second problem may be a bad repository mirror or a transfer problem (binary to ascii). Here's the official repository URL with the ICC profile from the example:
https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/resources/org/apache/pdfbox/resources/pdfa/

Removing a method call from inside a static lib(.a) without recompiling

I'm using a static lib thats giving me a warning when uploading my binary for review by apple.
The method in the static lib that causes the warning(non-public selectors) is never called by me, its corresponding .h is deleted from my proj, but warning still persists.
Given that I know the method name causing the problem, is there a way for me to open/edit this .a and comment/delete the offending piece of code and then use the modified .a in my project.
I don't have access to the .a source to recompile it, and its very old and the creator of it has no contact details for me to track down.
Many Thanks,
-Cake
Quick and dirty solution: Open the .a file in a hex editor and change all instances of the name. Leave the function name the same length so that offsets in the file don't change, just change a letter or something like that. I did a quick test, adding a dummy function to a subproject we're building as a static library then tweaking the function name in the .a file (there were five instances, for what that's worth) and everything built okay. I don't see any reason it wouldn't pass the App Store check after that.
I'm really surprised the function was still there in the final build, though—I thought Dead Code Stripping was supposed to clean out any unused code. Huh.
http://opensource.apple.com/source/cctools/cctools-809/
I don't presume to get your bounty, because I haven't provided an easy solution. But yes, it in theory is possible. You have your work cut out for you.
There are several solutions, depending on your lib and project.
In your build settings :
Enable "dead code stripping" if possible : If the method is never used (even internally), the symbol will be deleted.
Use "Unexported symbol file" : Simply add the symbol into a file and it will be removed from the binary. This will work even if the symbol is used internally.
Enable "Deployment Postprocessing" and "Strip Linked Product" with "Strip Style" set to "All symbol"
(Not sure) Use "Symbols Hidden by Default". This is related to the code generation and should not affect linking, but just in case everything above failed...
No need to hack the binary files. Just turn off the compiler's "unused selectors" warning: -fno-unused-selectors.