Thursday, December 26, 2019

Jackson KotlinModule signature changed between versions

I'm working with several Gradle plugins that use Jackson for JSON and/or YAML parsing. They're written in Kotlin, so they take advantage of the Jackson Kotlin module. I found after trying to upgrade some plugins' dependencies that Gradle sync always crashed with a NoSuchMethodError regarding the KotlinModule constructor. It appears that that constructor gained a new optional parameter - which changes its JVM method signature - in multiple versions, which is a binary-incompatible change. That makes differences in dependency version very likely to cause crashes. Updating some but not all plugins to 2.10.x causes a problem; 2.9.8 and 2.9.9 seem to be fine.

Wednesday, December 25, 2019

Provided Robolectric shadows can be replaced

Robolectric provides shadows of many Android classes and has a way to register custom shadows. Today I needed more functionality from a shadow that already existed. Fortunately, it seems that any user-provided shadows (registered in robolectric.properties as usual) replace the defaults.

Wednesday, December 18, 2019

When Get-Content doesn't recognize the -Encoding parameter

PowerShell's Get-Content cmdlet can read NTFS alternate data streams either with the -Stream parameter or by putting the stream after a colon in the path. Using the latter approach and trying to get the data of a file in the current directory as a byte array, someone mentioned that they received an error saying "a parameter cannot be found that matches parameter name 'Encoding'". This turned out to be because the path wasn't being interpreted as a file system path because it wasn't qualified - the .\ was missing. So the file system provider wasn't being used, and apparently that provider is responsible for some dynamic parameters like -Encoding. Qualifying the path fixed the problem.

Wednesday, December 4, 2019

When Android Studio says "this project does not use the Gradle build system" in the presence of build.gradle

Today I helped a student who was seeing some strange behavior from Android Studio. The IDE appeared to be mostly working, but compilation failed with errors about being unable find several items that all happened to be provided by a library.

Opening the project produced a "Migrate to Gradle" suggestion stating that "this project does not use the Gradle build system." Accordingly, there was no File | Sync Project with Gradle Files menu item. The project had been created as a Gradle project. I was shown screenshots that confirmed the existence and contents of all expected build.gradle files, which was very confusing because the migration suggestion appeared even after clearing all caches I could think of.

Staring very intently at the screen eventually revealed a subtle problem: the parent directory of the project had been opened, not the project itself. Since there was no build.gradle in the opened root directory, Android Studio rightfully did not consider it a Gradle project, but allowed setting the Android SDK manually (which is what the student must have done to be able to attempt compilation). Opening the correct location in the directory hierarchy fixed the problem.

Thursday, November 21, 2019

Windows comes with the tar utility now

Recently I needed to extract a tar.gz archive on Windows as part of an automated pipeline. I tried fiddling with 7-zip and WinRAR's command-line executable but hoped for something more straightforward. I had the Linux subsystem installed, and I knew about the tar utility, so I poked around and accidentally noticed that there's a tar provided by Windows even outside WSL. tar xzf works for extracting tar.gz files from the Windows command line just like on Linux.

Friday, November 15, 2019

Policy Plus - Several fixes

I had some fun today fixing a couple issues with Policy Plus. I previously thought that the undocumented multiTextBox presentation element had no attributes other than ID, but it turns out to sometimes have a label as the tag's inner text. Policy Plus will now display the multiline text box's label if specified.

While double-checking that multiTextBoxes work with Semantic Policy, I noticed that Semantic Policy import was broken for user policies; all policies were always imported to the machine policy source. That was an easy fix.

The changes are live on GitHub.

Saturday, November 2, 2019

"Found cyclical include chain" can be caused by tools:layout

Today I helped a student who was getting a "found cyclical <include> chain" error from the Android Studio UI designer. Despite the error message, there was no <include> tag in the layout's XML. Rather, the self-inclusion was from a tools:layout attribute, set as the layout attribute in the Attributes pane of a fragment.