Is it possible to turn of only a specific kind of warning in scalac? - intellij-idea

Call me stubborn, but they can get my /: and :\ out of my cold, dead fingers. I can't wait for scala 2.14 when they are supposed to go away so that I can implement my own and get rid of the deprecation warning completely, but is there anything I can do in the meantime - in scalac, sbt or at least IntelliJ to filter out those warnings? I am an absolute noob with regard to sbt, but it seems like something that should be very easily accomplished.

Scala 2.13.2 has just been released a few days ago, which includes a new -Wconf flag for configurable warnings. See https://github.com/scala/scala/pull/8373
Configure compiler warnings.
Syntax: -Wconf:<filters>:<action>,<filters>:<action>,...
multiple <filters> are combined with &, i.e., <filter>&...&<filter>
Note: Run with `-Wconf:any:warning-verbose` to print warnings with their category, site,
and (for deprecations) origin and since-version.
<filter>
- Any message: any
- Message categories: cat=deprecation, cat=lint, cat=lint-infer-any
The full list of warning categories is shown at the end of this help text.
- Message content: msg=regex
The regex need only match some part of the message, not all of it.
- Site where the warning is triggered: site=my\.package\..*
The regex must match the full name (`package.Class.method`) of the warning position.
- Source file name: src=src_managed/.*
If `-rootdir` is specified, the regex must match the canonical path relative to the
root directory. Otherwise, the regex must match the canonical path relative to any
path segment (`b/.*Test.scala` matches `/a/b/XTest.scala` but not `/ab/Test.scala`).
Use unix-style paths, separated by `/`.
- Origin of deprecation: origin=external\.package\..*
The regex must match the full name (`package.Class.method`) of the deprecated entity.
- Since of deprecation: since<1.24
Valid operators: <, =, >, valid versions: N, N.M, N.M.P. Compares against the first
version of the form N, N.M or N.M.P found in the `since` parameter of the deprecation,
for example `1.2.3` in `#deprecated("", "some lib 1.2.3-foo")`.
<action>
- error / e
- warning / w
- warning-summary / ws (summary with the number of warnings, like for deprecations)
- warning-verbose / wv (show warning category and site)
- info / i (infos are not counted as warnings and don't affect `-Werror`)
- info-summary / is
- info-verbose / iv
- silent / s
The default configuration is:
-Wconf:cat=deprecation:ws,cat=feature:ws,cat=optimizer:ws
User-defined configurations are added to the left. The leftmost rule matching
a warning message defines the action.
Examples:
- change every warning into an error: -Wconf:any:error
- silence certain deprecations: -Wconf:origin=some\.lib\..*&since>2.2:s
Full list of message categories:
- deprecation
- feature, feature-dynamics, feature-existentials, feature-higher-kinds, feature-implicit-conversions, feature-macros, feature-postfix-ops, feature-reflective-calls
- java-source
- lint, lint-adapted-args, lint-byname-implicit, lint-constant, lint-delayedinit-select, lint-deprecation, lint-doc-detached, lint-eta-sam, lint-eta-zero, lint-implicit-not-found, lint-inaccessible, lint-infer-any, lint-missing-interpolator, lint-nonlocal-return, lint-nullary-override, lint-nullary-unit, lint-option-implicit, lint-package-object-classes, lint-poly-implicit-overload, lint-private-shadow, lint-recurse-with-default, lint-serial, lint-stars-align, lint-type-parameter-shadow, lint-unit-specialization
- optimizer
- other, other-debug, other-match-analysis, other-migration, other-pure-statement, other-shadowing
- scaladoc
- unchecked
- unused, unused-imports, unused-locals, unused-nowarn, unused-params, unused-pat-vars, unused-privates
- w-flag, w-flag-dead-code, w-flag-extra-implicit, w-flag-numeric-widen, w-flag-self-implicit, w-flag-value-discard
To suppress warnings locally, use the `scala.annotation.nowarn` annotation.
Note: on the command-line you might need to quote configurations containing `*` or `&`
to prevent the shell from expanding patterns.
For anyone else still stuck with an earlier Scala version, there is the silencer scalac plugin: https://github.com/ghik/silencer

Related

How to fail Velocity template processing with tracable message

Having:
Velocity template or macro
some object
How to validate the object (#if) and fail (stop further processing) in a way that is easily tracable to the place of failure (like throwing exception in Java).
I am looking for something like this:
#if ( ! $context.treasureMap.containsKey('gold'))
#fail('no golden treasure here')
#end
Background
I am writing a maven site page. The velocity context is injected by maven and contains POM information. I want to test existence of some information from effective pom. When the information is not available, I want to fail.
Requirements
fail Velocity processing > fail site generation > fail maven build.
error message should lead to the place of failure so the site should be fixed
preferably no configuration (no extensions, just constructs/tools contained in plain Velocity)
Tried
Strict Reference Mode
Unwanted configuration, do not want to fail on every occasion.
#evaluate('#end') aka syntax error
(Chose #end as most descriptive to my intent) Basically what I want. Fails the processing and maven build but the error message does not lead back to failure location:
ParseException: Encountered "#end" at line 1, column 1..
You need to make a method call which produce exception.See explanation:
The only place where one could run into trouble within Velocity is if there is a call to a method which throws an exception during runtime. For example, this VTL defines a String $foo and then attempts to call its substring() method on it would throw an IndexOutOfBoundsException:
#set ($foo = "bar")
#set ($bar = $foo.substring(0,10))
When the exception is thrown, the parser will stop processing and throw that exception up the stack tree where it can be caught in the method that caused the parser to execute. At that point, the exception can be handled gracefully.

Drools Fusion 'variablename' unexpected

I am working on making a CEP using Drools Fusion. I have two classes of events ExpectedEvent and ActualEvent. I need to make sure ActualEvent objects occur before ExpectedEvent objects. However, I cannot get the before key word to work. This is in stream mode.
import hellodrools.ExpectedEvent
import hellodrools.ActualEvent
dialect "java"
rule "On Time"
when
ExpectedEvent($expectedtime : getStart_time()) from entry-point entry one
$actual:ActualEvent( this after[ 1m ] $expected ) from entry-point entryone
then
System.out.println("ON TIME expected time: " + $expectedtime + " actual time " + $actualtime);
end
In IntelliJ I keep getting errors on $actual saying '$actual' unexpected. I cannot solve this syntax error.
I don't think this is related to IntelliJ, although IntelliJ here appears not be reporting the correct error.
I believe the actual problem here is that from entry-point expects a String literal or a valid identifier, which will be used for the entry point ID (which is a String)
In your rule the "entry one" is not a valid identifier because it contains a space, and it's not a String literal because it's not enclosed in double-quotes characters (").
You can try replacing from entry-point entry one
with from entry-point "entry one"

Error Loading Minecraft World when using MoCreatures, Realistic World Gen, and CustomMobSpawner

Using:
- Minecraft 1.7.10
- Forge 10.13.4.1614
- [Mod] Dr. Zhark's Mo Creatures (not enough rep to post link)
- [Mod] Realistic World Generator (RWG) 2
- [Mod] Dr. Zhark's Custom mob Spawner (CMS) (not enough rep to post link)
I attempted to modify the config files in the .minecraft folder to add all of the RWG Biomes to the acceptable spawn locations for the MoCreatures mod via CMS. I modified the EntityBiomeGroups.cfg file found at
C:...\AppData\Roaming.minecraft\config\CustomSpawner\overworld
And just for an example of the code used in the file:
S:MOC_MEDIUMFISH_DEFAULT <RWG|rwg_oceanIce:RWG|rwg_oceanCold:RWG|rwg_oceanTemperate:RWG|rwg_oceanHot:RWG|rwg_oceanWet:RWG|rwg_oceanOasis:MC|Swampland:MC|MushroomIslandShore:MC|Beach:MC|Stone Beach:MC|Cold Beach:MC|Swampland M>
After modifying the file, and checking multiple times to ensure that everything was typed in correctly, I received this error while attempting to load any minecraft world:
Description: Exception in server tick loop
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1954)
at drzhark.customspawner.utils.CMSUtils.parseName(CMSUtils.java:63)
at drzhark.customspawner.environment.EnvironmentSettings.populateSpawnBiomes(EnvironmentSettings.java:732)
at drzhark.customspawner.environment.EnvironmentSettings.updateSettings(EnvironmentSettings.java:259)
at drzhark.customspawner.utils.CMSUtils.addWorldEnvironment(CMSUtils.java:128)
at drzhark.customspawner.EventHooks.onWorldLoad(EventHooks.java:175)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_156_EventHooks_onWorldLoad_Load.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:73)
at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:92)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)
I do not understand this completely. Does it help me find where the error is? Can anybody read this and tell me where I can find it? I'm at a loss here.
May be this mod download is error,
you try reinstall this mod - download here

How to resolve this (disagrees about version of symbol) for example for (journal_restart)?

I try to modify Jbd Module.symvers and make versions of these functions of jbd the same as what is in /proc/kallsyms (for all symvers:ext3, root kernel directory and jbd), but when compiling it will be the same old value in jbd/Module.symvers (not seeable in jbd.mod.c). I've seen scripts/mod/modpost.c and there was no instance of those symbols (like journal_restart. I see a lot of disagree about version of .... and the next line this Unknown symbols... of that in disagree symbold in dmesg.
How can resolve this problem for example for (journal_restart)?
Thanks!

Players can't build in bPermissions

I have created my default group in bPermissions and the players that have the default rank can't build, I can't figure out why. I have even added the permission node "bpermissions.build". Here is the groups.yml:
default: default
groups:
default:
permissions:
- bpermissions.build
- essentials.afk
- essentials.afk.auto
- essentials.back
- essentials.home
- essentials.sethome
- essentials.spawn
- essentials.suicide
- mineconomy.balance.check
- mineconomy.bank.account.balance
- plotme.limit.1
- plotme.use.add
- plotme.use.auto
- plotme.use.buy
- plotme.use.protect
- plotme.use.remove
- warptastic.makesign
- warptastic.warp
groups: []
Please Help!
Try using the permission essentials.build
Your bpermissions.build is lowercase... Did you try uppercase?
As in: bPermissions.build
It's not the spawn area they're trying to build in, is it?
For bPermissions, you have to use the groups.yml in plugins/bPermissions/world-name, don't forget to set the other worlds to mirror the original world (same permissions for Nether and what not).
If that's the one you're using: are you SURE there isn't an issue with bPermissions and Essentials butting heads? Often mods won't work properly or certain functions fail to work due to them fighting.
On a side note, is there a reason you don't have the meta/priorities? It doesn't really matter right this second since you only have one group in this example, but add it if you plan on creating other groups like Mods and Admins or w/e.
I didn't need a permission for being able to build, it was enabled to all players by default o.o So I'm assuming that it's Essential permissions making it up or something xD If you want the building ability to be false for bPermissions, you'll have to tell it to be false.