question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`targetName` on a type element is ignored

See original GitHub issue

Compiler version

3.1.1-RC1

Minimized code

package com.example

import scala.annotation.targetName

class TargetName:
  def genericId[@targetName("this_is_ignored") *](value: *): * = value

Output

javap TargetName:

Compiled from "TargetName.scala"
public class com.example.TargetName {
  public com.example.TargetName();
  public <$times> $times genericId($times);
}

Expectation

Not sure if the expected result is a renamed type or a restriction on the use of targetName. Anyway, the compiler shows a warning if @targetName is not present:

type * has an operator name; it should come with an @targetName annotation

so I guess it is a bug 🙂

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
oderskycommented, Dec 7, 2021

We should also check that other illegal target names are rejected. E.g. following:

import annotation.targetName

object Test extends App:

  @targetName("<init>") def test = ???

There are lots of other examples like this. One needs to consult the docs what constitutes a legal method name.

0reactions
oderskycommented, Dec 11, 2021

It looks like this would be pretty hard to change, and parameter names should not matter anyway for generic signatures.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Property 'name' does not exist on type 'EventTarget' - React + ...
While the solution proposed by @Agney will probably work in most cases, it failed me when I was using event delegation – the...
Read more >
target dev name will be ignored for network interface when ...
Manually specified targets using these prefixes may be ignored. Actual result: target name cannot be manually set, it's ignored by libvirt and automatically...
Read more >
MSBuild Items - Microsoft Learn
Items are grouped into item types based on their element names. Item types are named lists of items that can be used as...
Read more >
Move definitions of BeforeBuild and AfterBuild targets ... - GitHub
I presume that the intention was for you to override them in your project files after the .targets import near the bottom of...
Read more >
Targets and Extension-Points - Apache Ant
A target name can be any alphanumeric string valid in the encoding of the XML file. The empty string is in this set,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found